# C++ program to enter the length and breadth of a rectangle and find its area

ADVERTISEMENTS

In this article, you will learn how to find the area of a rectangle in the c++ language.

You should have the knowledge of the following topics in c++ programming to understand this program.

- C++

function**main()** - C++

object**cin** - C++

object**cout**

### Standard formula to calculate the area of a rectangle

`P = l * w`

### where

`P`

= perimeter

`l`

= length of the rectangle

`w`

= width of the rectangle

### Source Code

```
/* C++ program to find the area of a rectangle */
#include <iostream>
using namespace std;
int main()
{
float l, w, a;
cout << "Enter the length & width of the rectangle::\n";
cin >> l >> w;
/* Calculate area of rectangle */
a = l * w;
/* Print output */
cout << "\nArea of rectangle = " << a << " units";
return 0;
}
```

### Output

`Enter the length & width of the rectangle::`

`5`

`7`

`Area of rectangle = 35 units`

### Explanation

In the given program, we have taken the inputs

rectangle's height and **5**

rectangle's width the applied the standard formula **7** then It returned to the area

**p = l * w**

**35 units**

value of the rectangle.