C program to find out area of trapezium





1. C program or source code for find area of trapezium
2. How to calculate area of trapezium in c programming language


#include<stdio.h>
int main(){
    float height,base1,base2;
    float area;
    printf("Enter the height of the trapezium: ");
    scanf("%f%",&height);
    printf("Enter length of lower base of the trapezium: ");
    scanf("%f%",&base1);
    printf("Enter length of upper base of the trapezium: ");
    scanf("%f%",&base2);
    area = 0.5 * (base1 + base2) * height;
    printf("Area of trapezium is: %f",area);
    return 0;
}




No comments: