1.

Write a C++ program to find the area of a triangle given three sides.

Answer»

#include <iostream.h>

#include <math.h>

#include <conio.h>

void main()

{

double s1,s2,s3,s,area;

clrscr();

cout<<Enter the length of 3 sides";

cin>>s1>>s2>>s3;

s = (s1 + s2 + s3)/2;

area = sqrt(s*(s - s1)*(s - s2)*(s - s3));

cout <<"Area = "<<area <<end1;

getch();

}



Discussion

No Comment Found

Related InterviewSolutions