Calculator Program in C#.NET

1,097 views

Published on

Calculator Program in C#.NET Which can Perform Additon , Subtraction , Multiplication , Divison

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,097
On SlideShare
0
From Embeds
0
Number of Embeds
35
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Calculator Program in C#.NET

  1. 1. (1) Write a C# Program for Basic Calculator which can handle addition, subtraction, multiplication, and division. Source Code: using using using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Linq; System.Text; System.Threading.Tasks; System.Windows.Forms; namespace Calc { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void pictureBox1_Click(object sender, EventArgs e) { } private void Form1_Load(object sender, EventArgs e) { } float number1 , number2 , add , sub , mul ,div; private void button1_Click(object sender, EventArgs e) { number1 = Convert.ToInt32(textBox1.Text); number2 = Convert.ToInt32(textBox2.Text); add = number1 + number2; textBox3.Text = add.ToString(); }
  2. 2. private void button2_Click(object sender, EventArgs e) { number1 = Convert.ToInt32(textBox1.Text); number2 = Convert.ToInt32(textBox2.Text); sub = number1 - number2; textBox3.Text = sub.ToString(); } private void button3_Click(object sender, EventArgs e) { number1 = Convert.ToInt32(textBox1.Text); number2 = Convert.ToInt32(textBox2.Text); mul = number1 * number2; textBox3.Text = mul.ToString(); } private void button4_Click(object sender, EventArgs e) { number1 = Convert.ToInt32(textBox1.Text); number2 = Convert.ToInt32(textBox2.Text); div = number1 / number2; textBox3.Text = div.ToString(); } } } Output:

×