Calculating the AREA of a triangle using equation and if
else:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,area,s;
clrscr();
printf("\n Enter a:");
scanf("%f",&a);
printf("\n Enter b:");
scanf("%f",&b);
printf("\n Enter c:");
scanf("%f",&c);
if((a+b>c)&(b+c>a)&(c+a>b))
{
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-a));
printf("\n the value of s is=%f",s);
printf("\n the value of area=%f",area);}
else
printf("Not possible");
getch();
}
No comments:
Post a Comment
Please comment bellow. Share your knowledge