# C program to read length width and compute Area Perimeter

Write a C program to read length and width from the input and compute the perimeter and area of the rectangle.

### Problem Definition:

In this program, we will read the length and breadth of the rectangle. Next, we find the area and perimeter of a rectangle.

### Source code of C program to read length width and compute Area Perimeter

```#include<stdio.h>
int main()
{
float length,width;
float area,perimeter;
printf("Enter the length of a Rectangle: ");
scanf("%f",&length);
printf("Enter the width of a Rectangle: ");
scanf("%f",&width);

area=length*width;            //calculates area
perimeter=2*(length+width);   //calculates perimeter

printf("\nArea of a rectangle is %f",area);
printf("\nPerimeter of a rectangle is %f",perimeter);
}```

### Output:

Case 1:

Enter the length of a Rectangle: 10

Enter the width of a Rectangle: 20

Area of a rectangle is 200.000000

Perimeter of a rectangle is 60.000000

Case 2:

Enter the length of a Rectangle: 20

Enter the width of a Rectangle: 10

Area of a rectangle is 60.000000

Perimeter of a rectangle is 200.000000

### Program Explanation:

1. First, create 4 variables such as length, breadth, area, and perimeter of type float.