# C Program to Find the Perimeter and Area of a Rectangle

In this C program, we will calculate the perimeter and area of rectangle. To find the perimeter and area of rectangle, we will first take length and breadth of rectangle as input from user using scanf function and then calculate area and perimeter of rectangle using following formulae.

#### Required Knowledge

• Perimeter of Rectangle = 2 x (length + width)
• Area of Rectangle = length x width

## C program to find the perimeter and area of rectangle

```#include <stdio.h>

int main() {
float length, width, area, perimeter;

printf("Enter length of Rectangle\n");
scanf("%f", &length);
printf("Enter width of Rectangle\n");
scanf("%f", &width);

perimeter = 2 * (length + width);
printf("Perimeter of Rectangle : %f\n", perimeter);

area = length * width;
printf("Area of Rectangle : %f\n", area);

return 0;
}
```

Output
```Enter length of Rectangle
3.5
Enter width of Rectangle
5
Perimeter of Rectangle : 17.000000
Area of Rectangle : 17.500000
```

Related Topics
 C program to calculate area of a rectangle C program to calculate area of a parallelogram C program to calculate area of a rhombus C program to calculate area of a trapezium C program to calculate area of a square C program to calculate area of any triangle C program to calculate volume and total surface area of cylinder C program to calculate volume and total surface area of sphere C program to calculate area of an equilateral triangle List of all C programs