JavaScript program to calculate parallelogram circumference

Views: 116   

Following program shows you how to calculate parallelogram circumference.
This program gets parallelogram base and side from user and calculates circumference and prints it using following formula
Circumference = 2 X base X side

var parallelogramBase = parseInt(prompt("Please enter base of parallelogram:"));
var parallelogramSide = parseInt(prompt("Please enter side of parallelogram:"));
var circumferenceOfParallelogram = 2 * (parallelogramBase + parallelogramSide);
console.log("Circumference of parallelogram is: " + circumferenceOfParallelogram);

Output:

Please enter base of parallelogram: 
10
Please enter side of parallelogram: 
30
Circumference of parallelogram is: 80.0
On By