C program to find area of a rectangle
Write a C program to enter the length and breadth of a rectangle and find its area using operators and the formula.
To find area of a rectangle we have to use the formula -
AREA = LENGTH * BREADTH
And we can use operators to implement the same formula in our C program.
Example -
Input: Enter length of the rectangle: 20
Enter breadth of the rectangle: 10
Output: Area of rectangle: 200.000000
C program to find area of a rectangle
#include <stdio.h>
void main()
{
float length, breadth, area;
printf("Enter length of the rectangle: ");
scanf("%f", &length);
printf("Enter breadth of the rectangle: ");
scanf("%f", &breadth);
area = length * breadth;
printf("Area of rectangle: %f", area);
}
Output
Enter length of the rectangle: 20
Enter breadth of the rectangle: 10
Area of rectangle: 200.000000