C++ program to find area of a triangle.
Q22. Write a program to find area of a triangle.
Ans.
#include<iostream.h>
#include<conio.h> //for clrscr()
//Main() function
void main()
{
float height,base,area;
clrscr(); //for clear screen
cout<<“\n Enter the height and base of the triangle: “;
cin>>height>>base;
area=(height*base)/0.5;
cout<<“\n The area of triangle is: “<<area;
getch(); //To hold the output screen
}
//End of main()
Output:
Enter the height and base of the triangle: 5 9.6
The area of triangle is: 96