Friday, October 4, 2013

WAP to input 3 sides of triangle and calculate area.



#include<conio.h>
#include<stdio.h>
#include<math.h>
int main()
{
float a,b,c,s,A;
printf("\n enter the value of the sides of the triangle:");
scanf("%f%f%f",&a,&b,&c);
s=(a+b+c)/2;
A=sqrt(s*(s-a)*(s-b)*(s-c));
printf("\n the area of the triangle is:%f",A);
getch();
return 0;
}

2 comments:

  1. why this prog does not work with "pow" function?????????

    ReplyDelete
  2. This will work
    pow(s*(s-a)*(s-b)*(s-c), .5)

    ReplyDelete