Computer Science, asked by biswasprapti18, 7 months ago

write a javascript program to accept length and breadth of a rectangle and calculate the area ​

Answers

Answered by itzBrainlymaster
3

Answer:

Following program shows you how to calculate rectangle area and circumference. This program gets rectangle length and width from user and calculates area and circumference and prints them using following formulas Area = length X width Circumference = 2 X length + 2 X width

var rectangleLength = parseInt(prompt("Enter length of rectangle:"));

var rectangleWidth = parseInt(prompt("Enter width of rectangle:"));

var areaOfRectangle = rectangleLength * rectangleWidth ;

console.log("Area of rectangle is: " + areaOfRectangle);

var circumferenceOfRectangle = 2 * (rectangleLength) + 2 * (rectangleWidth);

console.log("Circumference of rectangle is: " + circumferenceOfRectangle);

Output:

Enter length of rectangle:

50

Enter width of rectangle:

60

Area of rectangle is: 3000.0

Circumference of rectangle is: 220.0

Similar questions