C# Program to Calculate the Area of a Rectangle
In this C# program, we will take input (Length and Width) from the user and calculate the area of a Rectangle. Formula to calculate area of Rectangle is A= Length*Width.
C# Program to Calculate the Area of a Rectangle Code:
private static void Main(string[] args)
{
double Length, Width;
Console.Write("Enter Length of Rectangle: ");
Length = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter Width of Rectangle: ");
Width = Convert.ToDouble(Console.ReadLine());
double area = Length * Width;
Console.WriteLine("Area of Rectangle is : {0}", area);
Console.ReadLine();
}
C# Program to Calculate the Area of a Rectangle Output:
