Question #48751

Given the lengths a,b,c of the sides of triangle, write a function based program to compute the area of the triangle.,The formula for computing the area is given by:

Area = √ s(s-a)(s-b)(s-c)

where s is the semiparameter of the triangle

s=(a+b+c)/2
1

Expert's answer

2014-11-10T11:02:36-0500
#include <stdio.h>
#include <math.h>
double GetArea(double, double, double);
int main(){
    double a, b, c, area;
    scanf("%lf", &a);
    scanf("%lf", &b);
    scanf("%lf", &c);
    area = GetArea(a, b, c);
    printf("Area: %lf\n", area);
    getchar(); getchar();
}
double GetArea(double a, double b, double c){
    double s = (a + b + c) / 2;
    return sqrt(s*(s - a)*(s - b)*(s - c));
}


http://www.AssignmentExpert.com/</math.h></stdio.h>

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS