C program to find an area of trapezoid.

 

01  #include<stdio.h>
02 #include<math.h>
03
04 int main()
05 {
06 int b1,b2,h;
07 float area;
08
09 printf("nEnter value of the bases : ");
10 scanf("%d %d", &b1,&b2);
11
12 printf("nEnter the value of the height : ");
13 scanf("%d", &h);
14
15 area = (float) ( (b1+b2)*h )/2;
16
17 printf("nArea of a Trapezoid : %.2f", area);
18 return 0;
19 }
 
 
OUTPUT :

Enter value of the bases : 5 10
Enter the value of the height : 12

Area of a Trapezoid : 90.00

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *