Write an algorithm to display area of triangle
Answers
Answer:
Algorithm
Step-1: Start.
Step-2: Input two numbers in variable a & b.
Step-3: Calculate c = a+b.
Step-4: Print value of c.
Step-5: Stop.
Please mark as brainlist
Thanks this answer by click on the heart
Following three algorithms can be used to calculate the area of a triangle:
Algorithm 1:
Input1 = length of base
Input2 = height
Output (Area) = 0.5 * Input1 * Input2
Algorithm 2: Heron's Formula
Input 1 = side1
Input 2 = side2
Input 3 = side3
Calculate semiperimeter s = (Input1 + Input2 + Input 3) / 2
Output (Area) = sqrt {s * (s - Input1) * (s - Input2) * (s - Input3)}
Algorithm 3: Co-ordinate Geometry
Accept the co- ordinates of the three vertices of the triangle as 6 inputs x1, y1, x2, y2, x3, ye
Apply distance formula to calculate the length of the three sides as:
side1 = sqrt { (x2 - x1) ^ 2 + (y2 - y1) ^ 2}
side2 = sqrt { (x3 - x2) ^ 2 + (y3 - y2) ^ 2}
side3 = sqrt { (x1 - x3) ^ 2 + (y1 - y3) ^ 2}
Once, we have got the lengths of the three sides, apply Algorithm 2.