0% found this document useful (0 votes)
11 views

Docs Up 2

program code

Uploaded by

Iqra khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Docs Up 2

program code

Uploaded by

Iqra khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Create the calculator in C# that take two inputs from the user and display output for

following buttons.

 Addition
 Subtraction
 Division
 Multiplication
Note: Use 4 respective buttons each for each process

SOLUTION

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 WindowsFormsApp3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
int input_text1, input_text2, division_input;
input_text1 = int.Parse(textBox1.Text);
input_text2 = int.Parse(textBox2.Text);
division_input = input_text1 % input_text2;
MessageBox.Show("Division Of Two Number is = " + division_input.ToString());

private void button2_Click_1(object sender, EventArgs e)


{
int input_text1, input_text2, multiplication_input;
input_text1 = int.Parse(textBox1.Text);
input_text2 = int.Parse(textBox2.Text);
multiplication_input = input_text1 * input_text2;
MessageBox.Show("Multiplication Of Two Number is = " +
multiplication_input.ToString());
}

private void button3_Click_1(object sender, EventArgs e)


{
int input_text1, input_text2, add_input;
input_text1 = int.Parse(textBox1.Text);
input_text2 = int.Parse(textBox2.Text);
add_input = input_text1 + input_text2;
MessageBox.Show("Addition Of Two Number is = " + add_input.ToString());
}

private void button4_Click_1(object sender, EventArgs e)


{
int input_text1, input_text2, subtract_input;
input_text1 = int.Parse(textBox1.Text);
input_text2 = int.Parse(textBox2.Text);
subtract_input = input_text1 - input_text2;
MessageBox.Show("Subtraction Of Two Number = " + subtract_input.ToString());
}
}
}

You might also like