Programming with JavaScript

⌘K
  1. Home
  2. Docs
  3. Programming with JavaScri...
  4. Example Programs
  5. Area of Rectangle

Area of Rectangle

Example 7:

Calculate the area of a rectangle and store the width and height in variables. Then, create a variable called “area” and calculate the area using the formula: area = width * height.

let width = 5;
let height = 6;
let area_rect = width * height;
console.log("Area of rectangle : ", area_rect);

Output:

Loading

Views: 98

How can we help?

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments