write a program in c language to find area of a tringle.
Answers
Answered by
0
Answer:
#include <stdio.h>
#include <math.h>
int main()
{
double a, b, c, s, area;
printf("Enter sides of a triangle\n");
scanf("%lf%lf%lf", &a, &b, &c);
s = (a+b+c)/2; // Semiperimeter
area = sqrt(s*(s-a)*(s-b)*(s-c));
printf("Area of the triangle = %.2lf\n", area);
return 0;
}
Explanation:
#include <stdio.h> #include <math.h>
double area_of_triangle(double, double, double);
int main() {
double a, b, c, area;
printf("Enter the lengths of sides of a triangle\n");
scanf ("%lf%lf%lf", &a, &b, &c);
area = area_of_triangle(a, b, c);
printf("Area of the triangle = %.21f\n",
area);
return 0;
}
double area_of_triangle( double a, double b, double c)
{
double s, area;
S = (a+b+c)/2;
area =
sqrt(s*(S-a)*(s-b)*(S-C));
return area;
}
Similar questions
Math,
2 months ago
Social Sciences,
2 months ago
Social Sciences,
2 months ago
India Languages,
4 months ago
Math,
4 months ago
English,
11 months ago
History,
11 months ago
Geography,
11 months ago