Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Metoder1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void btnKnap_Click(object sender, EventArgs e)
- {
- WriteOut(AddUp(ReadNumbers(1), ReadNumbers(2)));
- }
- int ReadNumbers(int temp)
- {
- if (temp == 1)
- {
- int tal = int.Parse(txtInput1.Text);
- return tal;
- }
- if (temp == 2)
- {
- int tal = int.Parse(txtInput2.Text);
- return tal;
- }
- return 0;
- }
- int AddUp(int temp1, int temp2)
- {
- int sum = temp1 + temp2;
- return sum;
- }
- void WriteOut(int temp)
- {
- lblUd.Text = temp.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment