C# Program to Calculate the Area of a Triangle

In this C# program, we will take input (Base and Height) from the user and calculate the area of a Triangle. Formula to calculate area of Triangle is A= (base*height/2).

C# Program to Calculate the Area of a Triangle Code:

private static void Main(string[] args)
        {
            double Base, Height;
            Console.Write("Enter Base of Triangle: ");
            Base = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter Height of Triangle: ");
            Height = Convert.ToDouble(Console.ReadLine());
            double area = Base * Height/2;
            Console.WriteLine("Area of Triangle is : {0}", area);
            Console.ReadLine();
        }	

C# Program to Calculate the Area of a Triangle Output:

C#-Program-to-Calculate-the-Area-of-a-Triangle

 

 
Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
6 + 7 =
 

About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice