Question: The following is an incorrect algorithm to output the largest value out of the 3 variables x,y and z. USE CORAL A) Where is the

The following is an incorrect algorithm to output the largest value out of the 3 variables x,y and z. USE CORAL A) Where is the error in this algorithm? What would you need to change for this algorithm to behave correctly? B) Rewrite the algorithm using cascading conditionals (if... elseif... else...)

The following is an incorrect algorithm to output the largest value out

1. The following is an incorrect algorithm to output the largest value out of the 3 variables x,y, and z : // Declare and read inputs integer x integer y integer z integer max x= Get next input y= Get next input z= Get next input // Output the largest integer if x>y and x>z max=x else if y>z max=z else max=y Put max to output A. Where is the error in this algorithm? What would you need to change for this algorithm to behave correctly? B. Rewrite the algorithm using cascading conditionals (if... elseif... else...)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!