C# program to find Area of Triangle by Sides
Program
using System;
namespace AreaOfTriangleBySides
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter the Side 1:\t");
float sideOne = float.Parse(Console.ReadLine());
Console.Write("Enter the Side 2:\t");
float sideTwo = float.Parse(Console.ReadLine());
Console.Write("Enter the Side 3:\t");
float sideThree = float.Parse(Console.ReadLine());
float s = (sideOne + sideTwo + sideThree) /2;
float area = (float)Math.Sqrt(s * (s - sideOne) * (s - sideTwo) * (s - sideThree));
Console.WriteLine("Area of triangle by its sides:\t" + area);
}
}
}
Output
Enter the Side 1: 25
Enter the Side 2: 12
Enter the Side 3: 15
Area of triangle by its sides: 63.27717