Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double h;
- double c;
- double s;
- var a = c = h = s = 0;
- int num = rnd.Next(0, 4);
- int value = rnd.Next(4, 25);
- num = 0;
- switch (num)
- {
- case 0:
- a = value;
- s = 0.5 * a * a;
- c = Math.Sqrt(2)*a;
- h = 0.5 * c * a;
- break;
- case 1:
- c = value;
- a = c / Math.Sqrt(2);
- h = 0.5 * c * a;
- s = 0.5 * a * a;
- break;
- case 2:
- h = value;
- a =h/Math.Sqrt(2)/2;
- s = 0.5 * a * a;
- c = Math.Sqrt(2)*a;
- break;
- case 3:
- s = value;
- a = Math.Sqrt(2*s);
- c = Math.Sqrt(2)*a;
- h = 0.5 * c * a;
- break;
- }
- Console.WriteLine($"Катет a = {a:F4}\nГипотенуза c = {c:F4}\nВысота, опущенная на гипотенузу h ={h:F4}\nПлощадь S ={s:F4} ");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement