Найти площадь треугольника - C# (195814)
Формулировка задачи:
Дан произвольный треугольник со сторонами a, b и c. Найти площадь треугольника?
Решение задачи: «Найти площадь треугольника»
textual
Листинг программы
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
private static double Solve(int a, int b, int c)
{
double p = (a + b + c) / 2d;
return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
}
static void Main(string[] args)
{
int a, b, c;
Console.WriteLine("ВВедите А = ");
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("ВВедите B = ");
b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("ВВедите C = ");
c = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Площадь треугольника равна "+Solve(a, b, c));
}
}
}