-
-
Save unilecs/8ce7f1217a6323e9aacb863dae3a9450 to your computer and use it in GitHub Desktop.
Задача 77: Площадь четырехугольника
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Program | |
{ | |
// Формула Герона для вычисления площади треугольника abc | |
public static double AreaByHeronFormula(double a, double b, double c) | |
{ | |
double p = (a + b + c) / 2.0; | |
return Math.Sqrt(p * (p - a) * (p - b) * (p - c)); | |
} | |
public static void Main() | |
{ | |
Console.WriteLine("UniLecs"); | |
Console.WriteLine(string.Format("Answer = {0}", AreaByHeronFormula(3, 4, 5) + AreaByHeronFormula(4, 2, 5))); // ~9.8 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment