#include<math.h> #include<conio.h> #include<stdio.h> void main() { float a,b,c,s,area; clrscr(); printf("enter the values of a,b,c"); scanf("%f %f %f",&a,&b,&c); s=(a+b+c)/2; area=sqrt(s*(s-a)*(s-b)*(s-c)); printf("the area of a trangle is : %f ",area); getch(); }
OUTPUT:
enter the values of a,b,c 12 36 45 the area of a trangle is : 158.955765Possible Error: 1) Function ‘sqrt( )’ should have a prototype : You should include ‘math.h’ Header file, And can use ‘sqrt ( )’ and all other mathematical functions.