write a generic C++ program that will enable students to calculate the area and volume of a trapezium. The program should prompt a student to enter the values for the length of the parallel sides and is perpendicular distance between the parallel sides respectively. The program should calculate and display the area and volume of the trapezium.
#include<iostream>
using namespace std;
void main()
{
float d,a,b,area;
cout<<"enter the value of perpendicular distance";
cin>>d;
cout<<"enter the parallel sides";
cin>>a>>b;
area=((a+b)*d)/2;
cout<<"the area of trapezium is";
cout<<area;
}
Comments
Leave a comment