A Program to Find the Area of a Rectangle
In this example, we are giving a program to find the area of a rectangle. The rule of finding the area of a rectangle is: A = width * height.
Program to find the area of a rectangle:
#include <stdio.h>
#include <stdlib.h>
int main() {
float w, h, area;
printf("Enter the value of width and height: ");
scanf("%f %f", &w, &h);
area = w * h;
printf("Area of rectangle: %.2f", area);
return 0;
}
Output:
Enter the value of width and height: 3, 4 Area of rectangle: 12.00