Question

In: Computer Science

Alogoritham

Develop an algorithm to find the area of the triangle where sides are a, b and c

Solutions

Expert Solution

Defining the problem:

The inputs are the sides a, b, and c of the triangle and area as its output. 
Is it possible to calculate the area of the triangle? Yes, it is possible

Analyzing the problem:

We know that the area (say a) of a triangle, when all its sides a, b, and c are given, can be found using Hero's Formula

Developing the Algorithm:

Step1: Sides of the triangle are a, b and c

Step2: Sum of the sides = a + b + c

Step3: Then s = a + b + c / 2

Step4: Area of the triangle: A = sqrt(s(s-a)(s-b)(s-c))

 


Algorithm to find out the area of the triangle 
Defining the problem
Analyzing the problem

Related Solutions

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT