# C Program to Enter Length and Breadth of a Rectangle and Find its Perimeter

__C__ program to enter length and breadth of a rectangle and find its perimeter.

In this article, you will learn how to write a c program to enter length and breadth of a rectangle and find its perimeter.

You should have knowledge of the following topics in c programming.

- C

function**main()** - C

function**printf()**

### Formula

This is the standard formula to calculate the perimeter of a rectangle.

**P = 2(l + w)**

### Where

**P = perimeter**

**l = length of the rectangle**

**w = width of the rectangle**

### Source Code

```
// C Program to Enter Length and Breadth of a Rectangle and Find its Perimeter
#include <stdio.h>
int main() {
float l, w, p;
printf("Enter the length & width of the rectangle::\n");
scanf("%f", &l);
scanf("%f", &w);
// Calculate perimeter of rectangle
p = 2 * (l + w);
// It will print the final output
printf("\nThe Perimeter of rectangle = %f units ", p);
return 0;
}
```

### Output

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

`5`

`7`

`The perimeter of rectangle = 24.000000 units`

### Explanation

In this program, we have taken two inputs from the user **rectangle's width**

and **5****rectangle's height** **7.**

Then used the standard formula

to calculate the perimeter of a rectangle then it will return the **P = 2(l + w)**

the perimeter of the rectangle.**24.000000 units**