Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Console.WriteLine("Let's calculate the square of a triangle");
- Console.WriteLine("Enter the length of side AB:");
- double ab = double.Parse(Console.ReadLine());
- Console.WriteLine("Enter the length of side BC:");
- double bc = double.Parse(Console.ReadLine());
- Console.WriteLine("Enter the length of side AC:");
- double ac = double.Parse(Console.ReadLine());
- double p = (ab + bc + ac) / 2; // вычисляем полупериметр треугольника
- double square = Math.Sqrt(p * (p - ab) * (p - bc) * (p - ac)); // находим площадь по формуле Герона
- Console.WriteLine($"Square of the triangle equals {square}");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement