Facebook Sayfamızı Beğenin

29 Şubat 2016 Pazartesi

Dairenin Alanını Ve Çevresini Hesaplayan Program - Csharp

public Form1()
 {
 InitializeComponent();
 }
 double r;
 double pi =3.14;
Alanı Hesaplama
1
2
3
4
5
6
7
8
private void button1_Click(object sender, EventArgs e)
 { //alan hesaplama pi*r*r
 double alan;
 r = Convert.ToDouble(textBox1.Text);
 alan = pi * Math.Pow(r, 2); //pi*r*r
 textBox2.Text = alan.ToString();
 
 }
Çevreyi Hesaplama
1
2
3
4
5
6
7
8
9
10
11
private void button2_Click(object sender, EventArgs e)
 {
 //2*pi*r çevre hesaplama
 double cevre;
 
r = Convert.ToDouble(textBox1.Text);
 cevre = 2 * pi * r;
 
textBox2.Text = cevre.ToString();
 
}

Hiç yorum yok:

Yorum Gönder