Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Area Of the triangle with condition

// 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.
Comment

PREVIOUS NEXT
Code Example
Csharp :: publish web app to linux or ubuntu 
Csharp :: texture matrix 
Csharp :: extension method c# 
Csharp :: c# decimal 
Csharp :: return array in c# 
Csharp :: custom vscode snippet 
Csharp :: palindromes 
Csharp :: c# capitalize first letter of each word in a string 
Csharp :: c# only only 2 digits after decimal number double 
Csharp :: c# is string nullable 
Csharp :: unity destroy 
Csharp :: unity find disabled gameobject 
Csharp :: how to print a variable in c# 
Csharp :: InverseTransformDirection 
Csharp :: c# window instantly close 
Csharp :: stackpanel opacity mask from resources wpf 
Csharp :: select list that does not exis in another C# list 
Csharp :: css text no word wrap 
Html :: turn off autocomplete input html 
Html :: how to open link in new tab 
Html :: favicon html link 
Html :: autoredirect html 
Html :: html make phone number callable 
Html :: centre text bootstrap 
Html :: html file input file filter 
Html :: html page back button 
Html :: upload icon font awesome 
Html :: alternative image in img tag 
Html :: language list select html 
Html :: less than symbol html 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =