double a = Convert.ToDouble(textBox1.Text);
double b = Convert.ToDouble(textBox2.Text);
Random rnd_num = new Random();
double X = rnd_num.NextDouble() * (b - a) + a;
double Y = rnd_num.NextDouble() * (b - a) + a;
double Masofa1 = Math.Sqrt((X - 0) * (X - 0) + (Y - 0) * (Y - 0));
double Masofa2 = Math.Sqrt((X - 2) * (X - 2) + (Y - 0) * (Y - 0));
double TS = Math.Sqrt(X*X + Y*Y);
if ( ( Masofa1 < 1 ) && (Masofa2 < 2) )
{
textBox3.Text = TS.ToString("f6");
richTextBox1.Text = "Sinov nuqtasi \n sohada";
}
else
{
textBox3.Text = TS.ToString("f6");
richTextBox1.Text = "Sinov nuqtasi \n sohada emas";
}
|