Area of Rectangle
Area of Rectangle
Example
Input
Enter length: 5
Enter width: 10
Output
Area of rectangle
Area of a rectangle is given by the formula -
Input length and width of rectangle. Store it in two different variables say length
and width.
Apply formula to calculate rectangle area i.e. area = length * width.
Finally, print the value of area.
Program to find area of rectangle
/**
* C program to find area of rectangle
*/
#include <stdio.h>
int main()
{
float length, width, area;
/*
* Input length and width of rectangle
*/
printf("Enter length of rectangle: ");
scanf("%f", &length);
printf("Enter width of rectangle: ");
scanf("%d", &width);
return 0;
}
Output
Enter length of rectangle: 5
Enter width of rectangle: 10
Area of rectangle = 50.000000 sq. units