C# program to calculate parallelogram area

Views: 119   

Fallowing program shows you how to calculate parallelogram area.
This program gets parallelogram base and height from user and calculates area and prints it using following formula
Area = base X height

using System;

class MainClass {
  public static void Main (string[] args) {
    Console.WriteLine ("Please enter base of parallelogram:");
    double parallelogramBase = Convert.ToDouble(Console.ReadLine());

     Console.WriteLine ("Please enter height of parallelogram:");
    double parallelogramHeight = Convert.ToDouble(Console.ReadLine());

    double areaOfParallelogram = parallelogramBase * parallelogramHeight;
    Console.WriteLine("Area of parallelogram is: " + areaOfParallelogram);

  }
}

Output:

Please enter base of parallelogram:
 12
Please enter height of parallelogram:
 15
Area of parallelogram is: 180
On By