Obszar trójkąta ze stanem

// C# program to print
// Floyd's triangle
using System;
 
class Test {
     
    // Function to find area
    static float findArea(float a, float b,
                        float c)
    {
         
        // Length of sides must be positive
        // and sum of any two sides
        // must be smaller than third side.
        if (a < 0 || b < 0 || c <0 ||
        (a + b <= c) || a + c <=b ||
            b + c <=a)
        {
            Console.Write("Not a valid triangle");
            System.Environment.Exit(0);
        }
        float s = (a + b + c) / 2;
        return (float)Math.Sqrt(s * (s - a) *
                            (s - b) * (s - c));
    }
         
    // Driver code
    public static void Main()
    {
        float a = 3.0f;
        float b = 4.0f;
        float c = 5.0f;
     
        Console.Write("Area is " + findArea(a, b, c));
    }
}
 
// This code is contributed Nitin Mittal.
Arrogant Aardvark