Program to calculate area and perimeter of a triangle.

Problem:

Write a program to calculate area and perimeter of a triangle.

Solution:

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
float pr,ar,a=4,b=5,c=9,h=5.2;
pr=a+b+c;
ar=1/2*b*h;
cout<<"the area of triangle is:"<<ar<<endl;
cout<<"the perimeter of triangle is:"<<pr<<endl;
getch();
}

Output:


Let me know in the comment section if you have any question.

Previous Post:
Program to calculate area, perimeter and volume of a square.