I need help making sure i put these in the correct for the a
I need help making sure i put these in the correct for the algorithem
ThePythagorean Theorem states that there is a relationship among the three sides of a right triangle. The hypotenuse (the side opposite the right angle) is equal to the square root of the sum of the squares of the two sides. The Pythagorean Theorem is often written
c 2= a2 +b2
where a and b each represent one side of the triangle and c represents the hypotenuse.
Your classmate Fred has written an algorithm based on the Pythagorean Theorem. Unfortunately, his algorithm has scrambled. Help Fred by reordering his instructions into a workable solution.
• Get the length of side 1 and store in a.
• Display the value stored in c.
• Calculate the hypotenuse using the formula: c = sqrt (a2 + b2)
• Get the length of side 2 and store in b.
***Turn in correct algorithm
Solution
As given we have to provide the correct algorithm for the Pythagorean theorem
The incorrect form of algorithm given in the question is as ,
• Get the length of side 1 and store in a.
• Display the value stored in c.
• Calculate the hypotenuse using the formula: c = sqrt (a2 + b2)
• Get the length of side 2 and store in b.
we have to make algorithm in the feasible form so that it is used to calculate the hypotenuse c.
The correct form of the algorithm should be,
• Get the length of side 1 and store in a.
• Get the length of side 2 and store in b.
• Calculate the hypotenuse using the formula: c = sqrt (a2 + b2)
• Display the value stored in c.
