A C++ program that calculate the Area of a triangle.
#include<iostream>
#include<conio.h>
#include<iomanip>
using namespace std;
main()
{
float base,height;
double area;
cout<<"Enter base : ";
cin>>base;
cout<<"Enter height : ";
cin>>height;
area = 0.5*base*height;
cout<<"Area = "<<setprecision(2)<<area;
return 0;
}
output:
Enter base : 10.5
Enter height : 5.4
Area = 28.35
0 Comments