Николай Веселуха
Высший разум
(360629)
3 года назад
using System;
namespace Answer {
class Program {
static void Main() {
var a = InputDouble("a: ");
var b = InputDouble("b: ");
var c = InputDouble("c: ");
var p = (a + b + c) / 2;
var arg = p * (p - a) * (p - b) * (p - c);
if (arg > 0) Console.WriteLine($"S: {Math.Sqrt(arg)}");
else Console.WriteLine("Треугольник не существует!");
Console.ReadKey();
}
static double InputDouble(string msg) {
double value;
do Console.Write(msg); while (!double.TryParse(Console.ReadLine(), out value));
return value;
}
}
}