programming-examples/c++/Basic/Area of a triangle.cpp

12 lines
271 B
C++
Raw Normal View History

2019-11-18 14:44:36 +01:00
#include < iostream.h >
void main()
{
int height, base;
float ans;/*ans may come in fractions*/
cout<<"Enter height and base";
cin>>height>>base;
ans= (1/2)*height*base;
/* mathematical formula*/
cout<<"Area if triangle is"<<ans;
}