# C++ Program to Find Area of Rectangle

In this program, we will learn how to find the area of a rectangle using C++ Programming language.

As we know, the area of a rectangle is the product of its length and its breadth.

• Area = Length x Breadth

So, without further ado, let’s begin this tutorial.

## C++ Program to Find Area of Rectangle

```// C++ Program to Find Area of Rectangle
#include <iostream>
using namespace std;

int main(){

cout << "Enter the length of the rectangle: ";
cin >> length;
cout << "Enter the breadth of the rectangle: ";

// Calculating area

// Display output
cout << "Area of Rectangle: " << area;
return 0;
}
```

Output

``````Enter the length of the rectangle: 5
Enter the breadth of the rectangle: 7
Area of Rectangle: 35
``````

## How Does This Program Work ?

```    int length, breadth, area;
```

In this program, we have declared some int data type variables named length, breadth and area.

```    // Asking for input
cout << "Enter the length of the rectangle: ";
cin >> length;
cout << "Enter the breadth of the rectangle: ";
```

Then, the user is asked to enter the length and breadth of the rectangle.

```    // Calculating area
```

We calculate area of the rectangle using the formula,

• Area = Length x Breadth
```    // Display output
cout << "Area of Rectangle: " << area;
```

Finally, the output is displayed on the screen using the cout statement.

## C++ Program to Find Area of Rectangle Using Functions

```// C++ Program to Find Area of Rectangle Using Functions
#include <iostream>
using namespace std;

int main(){

cout << "Enter the length: ";
cin >> length;
cout << "Enter the breadth: ";

// Calling out the function

// Displaying output
cout << "Area of the rectangle: " << area;
return 0;
}

}
```

Output

``````Enter the length: 4
Area of the rectangle: 24
``````
```int area_rect(int length, int breadth){
}
```

In this program, we have declared a custom function named area_rect which returns the area of the rectangle.

## Conclusion

I hope after going through this post, you understand how to find the area of a rectangle using C++ Programming language.

If you have any doubt regarding the program, feel free to contact us in the comment section. We will be delighted to solve your query.

1. 