Calculator in Asp.net C# easy method




Add  Button Coding
        int a, b, c;
        a = Convert.ToInt32(tb_1.Text);
        b = Convert.ToInt32(tb_2.Text);
        
        c = a + b;
      //Result is showing in label text You can  use Text box instead of label
            Lbl_result.Text = "Sum of two numbers is = " + c.ToString();
Subtraction  Button Coding

int a, b, c;
        a = Convert.ToInt32(tb_1.Text);
        b = Convert.ToInt32(tb_2.Text);
        
        c = a - b;
      
            Lbl_result.Text = "Subtraction of two numbers is = " + c.ToString();
Multiplication  Button Coding
int a, b, c;
        a = Convert.ToInt32(tb_1.Text);
        b = Convert.ToInt32(tb_2.Text);
        
        c = a * b;
      
            Lbl_result.Text = "Multiplication of two numbers is = " + c.ToString();

Devide  Button Coding
int a, b, c;
        a = Convert.ToInt32(tb_1.Text);
        b = Convert.ToInt32(tb_2.Text);
        
        c = a / b;
      
            Lbl_result.Text = "Devision of two numbers is = " + c.ToString();

0 Comments:

Post a Comment