Question: A student was asked to develop an algorithm to find and output the largest of three numerical values x , y , and z that
A student was asked to develop an algorithm to find and output the largest of three numerical values x y and z that are provided as input. Here is what was produced:
Input: x y z
Algorithm:
Check fi x y and x z fI it
is then output the value of x and stop. Otherwise, continue to the next line.
Check if y x and y z If it is then output the value of yand stop. Otherwise, continue to the next line.
Checkifzxandzy Ifitis, then output the value of z and stop.
Is this a correct solution to the problem? Explain why or why not. If it is incorrect, fix the algorithm so that it is a correct solution.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
