C#.Net Arithmetic Operators - Windows Application
Coding:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace LearnWithThiru
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox3.Text = (Convert.ToInt32(textBox1.Text) + Convert.ToInt32(textBox2.Text)).ToString();
}
private void button2_Click(object sender, EventArgs e)
{
textBox4.Text = (Convert.ToInt32(textBox1.Text) - Convert.ToInt32(textBox2.Text)).ToString();
}
private void button3_Click(object sender, EventArgs e)
{
textBox5.Text = (Convert.ToInt32(textBox1.Text) * Convert.ToInt32(textBox2.Text)).ToString();
}
private void button4_Click(object sender, EventArgs e)
{
textBox6.Text = (Convert.ToInt32(textBox1.Text) / Convert.ToInt32(textBox2.Text)).ToString();
}
private void button5_Click(object sender, EventArgs e)
{
//int a = Convert.ToInt32(textBox1.Text);
//int b = Convert.ToInt32(textBox2.Text);
//int c = a % b;
//textBox7.Text = c.ToString();
textBox7.Text = (Convert.ToInt32(textBox1.Text) % Convert.ToInt32(textBox2.Text)).ToString();
}
private void button6_Click(object sender, EventArgs e)
{
int a = Convert.ToInt32(textBox1.Text);
a++;
textBox8.Text = a.ToString();
}
private void button7_Click(object sender, EventArgs e)
{
int b = Convert.ToInt32(textBox2.Text);
b--;
textBox9.Text = b.ToString();
}
}
}
0 Comments