محاسبه مساحت دایره
کد:
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 WindowsFormsApplication22
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
double d1;
int az;
try
{
az = int.Parse(textBox1.Text);
d1 = masahat(az);
MessageBox.Show("masahat = " + d1);
}
catch (Exception)
{
MessageBox.Show("خطا ");
{
}
}
}
private double masahat(double a1)
{
double s1;
double s2;
s1 = a1 * a1;
s2 = s1 * Math.PI;
return s2;
{
}
}
}
}