FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 73   



Following program shows you how to calculate trapezoid circumference.
This program gets trapezoid bases and sides from user and calculates circumference and prints it using following formula
Circumference = base1 + base2 + side1 +side2

var trapezoidBase1 = parseInt(prompt("Please enter base1 of trapezoid:"));
var trapezoidBase2 = parseInt(prompt("Please enter base2 of trapezoid:"));
var trapezoidSide1 = parseInt(prompt("Please enter side1 of trapezoid:"));
var trapezoidSide2 = parseInt(prompt("Please enter side2 of trapezoid:"));
var circumferenceOfTrapezoid = trapezoidBase1 + trapezoidBase2 + trapezoidSide1 + trapezoidSide2;
console.log("Circumference of trapezoid is: " + circumferenceOfTrapezoid);

Output:

Please enter base1 of trapezoid:
3
Please enter base2 of trapezoid:
4
Please enter side1 of trapezoid:
8
Please enter side2 of trapezoid:
10
Circumference of trapezoid is: 25.0



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News