In this example, We are going to find Area of Rectangle in C.
The formula for calculating Area of any Rectangle is-
area = a * b
where a and is sides of rectangle
program to find area of rectangle
#include<stdio.h>
void main()
{
int a,b,area;
printf("Enter value for one side of Rectangle");
scanf("%d",&a);
printf("Enter value for other side of Rectangle");
scanf("%d",&b);
area = a * b;
printf("Area of the Rectangle = %d",area);
}
Output
Enter value for one side of Rectangle
10
Enter value for other side of Rectangle
15
Area of the Rectangle = 150
Introduction of C and Hello World Program
C program to Addition of two numbers
C program to find Area of Triangle
C program to find Area of Circle