Computer Science, asked by rajiv841227, 4 months ago

write a program in c language to find area of a tringle.​

Answers

Answered by kandyAG
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