How to write a C++ program to calculate area of a triangle ?
C++ Program to calculate area of a triangle |
Solution:
//Program to calculate area of a triangle.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a,b;
cout<<"Enter height: ";
cin>>a;
cout<<"Enter base: ";
cin>>b;
a=0.5*a*b;
cout<<"Area of the triangle is: "<<a;
getch();
}
This C++ Program to calculate area of a triangle.