JavaScript program to calculate parallelogram area

Views: 188   

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

var parallelogramBase = parseInt(prompt("Please enter base of parallelogram:"));
var parallelogramHeight = parseInt(prompt("Please enter height of parallelogram:"));
var areaOfParallelogram = parallelogramBase * parallelogramHeight;
console.log("Area of parallelogram is: " + areaOfParallelogram);

Output:

Please enter base of parallelogram: 
7
Please enter height of parallelogram: 
9
Area of parallelogram is: 63.0
On By