Computer Science, asked by krvishalboss, 2 months ago

Write a program to find the area of triangle.​

Answers

Answered by hkofficial654
0

Explanation:

C program to find area of a triangle

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);

Answered by swathi21025
0

Explanation:

C program to find area of a triangle using a function

#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 = %.2lf\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;

}

hope it helps you...

Similar questions