Program to find area of a triangle when there sides are given - 100 Most Important C# Programs

100 Most Important C# Programs

63. Program to find area of a triangle when there sides are given.

Code:

# include <stdio.h>

# include <conio.h>

main( )

{

int a,b,c;

float s, area;

clrscr( );

printf(“enter there sides of the triangle”);

scanf(“%d%d%d”,&a,&b,&c);

if((a+b)<c||(b+c)<a||(a+c)<b)

printf(“finding area is not possible”);

else

s=(a+b+c)/2;

area=sqrt(s*(s-a)*(s-b)*(s-c));

printf(“area=%.2f”,area);

getch( );

}