Q-5: Write a program to find area of a triangle: Area of triangle = sqrt[s(s-a)(s-b)(s-c)] where a,b, and c are three sides of the triangle and s=a+b+c/2.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
double s,a,b,c,aot;
clrscr();
printf("### Area Of Triangle ###\n");
printf("\nENTER THE VALUE FOR a:");
scanf("%lf",&a);
printf("\nENTER THE VALUE FOR b:");
scanf("%lf",&b);
printf("\nENTER THE VALUE FOR c:");
scanf("%lf",&c);
s=(a+b+c)/2;
printf("\nS=%lf",s);
aot=sqrt(s*(s-a)*(s-b)*(s-c));
printf("\nAREA OF TRIANGLE:%lf",aot);
getch();
}
No comments:
Post a Comment