 # C Program to Calculate Area of Rectangle

C program to calculate Area of Rectangle

In this program, we are going to see how to calculate the area of rectangle program in c. So let’s start!

## C Program to Calculate Area of Rectangle

To calculate the area of the rectangle we need a formula first, that is :

### Area = length * breadth

now we apply this formula to our program and we simply calculate the area of the rectangle let’s understand this with the help of the given program.

Method 1: using the standard formula.

//C program to find the maximum from the two numbers by using a user-defined function.

#include<stdio.h>
int main(){
printf(“Enter the length:”);
scanf(“%d”,&length);
printf(“Area of rectangle is %d”, area);
return 0;
}

Output

Enter the length: 2

The area of the rectangle is 8

Explanation:

• In the above program, we can see that there are three int-type variables to store the value of the length, breadth, and area of a rectangle.
• After that, we use Scanf to take user input in the form of length and breadth.
• Then we apply our formula and after that print the area of a rectangle that is set.

Method 2: By using a user-defined function.

// C program to calculate the area of a rectangle by using a user-defined function.

#include<stdio.h>
}

int main(){
printf(“Enter length:”);
scanf(“%d”,&length);
return 0;
}

Output

Enter length: 2