Computer Science, asked by silky567, 5 months ago

Write the algorithm to find the area of a triangle where area=1/2×B×H and the value of B and H are not given.
Answer correctly.​

Answers

Answered by sneha364152
1

Answer:

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.

Answered by BrainlyProgrammer
2

\huge\star\underbrace{\mathtt\red{⫷QúÊßTïØñ⫸}}\star

  • Algorithm to find area of a triangle

\huge\star\underbrace{\mathtt\red{⫷❥ᴀ᭄} \mathtt\green{n~ }\mathtt\blue{ §} \mathtt\purple{₩}\mathtt\orange{Σ} \mathtt\pink{R⫸}}\star

START

ACCEPT THE VALUES OF B AND H FROM THE USER

CALCULATE AREA=1/2*B*H

DISPLAY AREA

STOP

Similar questions