C#’ta işlemler

C#’ta toplama, çıkarma, çarpma, bölme ve üs alma işlemleri

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace WindowsApplication3

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

textBox3.Text = Convert.ToString(Convert.ToInt32(textBox1.Text) + Convert.ToInt32(textBox2.Text));

}

private void button2_Click(object sender, EventArgs e)

{

textBox3.Text = Convert.ToString(Convert.ToInt32(textBox1.Text) – Convert.ToInt32(textBox2.Text));

}

private void button3_Click(object sender, EventArgs e)

{

textBox3.Text = Convert.ToString(Convert.ToInt32(textBox1.Text) * Convert.ToInt32(textBox2.Text));

}

private void button4_Click(object sender, EventArgs e)

{

textBox3.Text = Convert.ToString(Convert.ToDouble(textBox1.Text) / Convert.ToDouble(textBox2.Text));

}

private void button5_Click(object sender, EventArgs e)

{

int i, a, b, c = 1;

a = Convert.ToInt32(textBox1.Text);

b = Convert.ToInt32(textBox2.Text);

for (i = 1; i <= b; i++)

c = c * a;

textBox3.Text=Convert.ToString(c);

}

}

}

Yazar: Tansu

Tansu DİLİ sitemizde 5 yazı eklemiş...

Share