Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

PROGRAM

Form.cs
using
using
using
using
using
using
using
using

System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;

namespace calci
{
public partial class Form1 : Form
{
int first, second, temp;
public Form1()
{
InitializeComponent();
}
private void clickk(object sender, EventArgs e)
{
Button b1 = (Button)sender;
if (b1.Text.Equals("button1"))
{
textBox1.Text += "1";
}
if (b1.Text.Equals("button2"))
{
textBox1.Text += "2";
}
if (b1.Text.Equals("button3"))
{
textBox1.Text += "3";
}
if (b1.Text.Equals("button4"))
{
textBox1.Text += "4";
}
if (b1.Text.Equals("button5"))
{
textBox1.Text += "5";
}
if (b1.Text.Equals("button6"))
{
textBox1.Text += "6";
}
if (b1.Text.Equals("button7"))
{
textBox1.Text += "7";
}
if (b1.Text.Equals("button8"))

UR11CS032

{
textBox1.Text += "8";
}
if (b1.Text.Equals("button9"))
{
textBox1.Text += "9";
}
}
private void op(object sender, EventArgs e)
{
Button oper = (Button)sender;
if (oper.Text.Equals("-"))
{
first = int.Parse(textBox1.Text);
temp = 1;
textBox1.Text = "";
}
if (oper.Text.Equals("+"))
{
first = int.Parse(textBox1.Text);
temp = 2;
textBox1.Text = "";
}
}
private void button10_Click(object sender, EventArgs e)
{
second = int.Parse(textBox1.Text);
if (temp == 1)
{
textBox1.Text = "" + (first - second);
}
if (temp == 2)
{
textBox1.Text = "" + (first + second);
}
}
}
}

Program.cs
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Windows.Forms;

namespace calci
{
static class Program
{

UR11CS032

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

OUTPUT

UR11CS032

You might also like