C++ Exercises
C++ Program to calculate the area of the Trapezoid.
Let see the program to calculate the area of the Trapezoid.
#include <iostream> using namespace std; int main() { double base1,base2,height,area; cout<<"Enter height of Trapezoid :"; cin>>height; cout<<"Enter base of Trapezoid :"; cin>>base1; cout<<"Enter base2 of Trapezoid :"; cin>>base2; area= (0.5*(base1+base2))*height; cout<<"Area of Trapezoid = :"<<area<<" sq. units."<<endl; return 0; }
Output:
Enter height of Trapezoid :10 Enter base of Trapezoid :5 Enter base2 of Trapezoid :7 Area of Trapezoid = :60 sq. units.