Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the following algorithms ( a and b) designed to take any three integers as

ID: 3643297 • Letter: G

Question

Given the following algorithms ( a and b) designed to take any three integers as input, compare them and display the largest value?

(a) Step 1: enter three integers x, y and z
Step 2: if (x >= y)
{
if (x >= z)
display x
else
display z
}
else
display y

(b) Step 1: enter three integers x, y and z
Step 2: create a new variable t and copy the value of x to t (i.e. t = x)
Step 3: if (y > t)
Copy the value of y to t (i.e. t = y)
Step 4: if (z > t)
Copy the value of z to t (i.e. t = z)
Step 5: display t



a. Both (a) and (b) are correct
b. Neither (a) nor (b) is correct
c. Only (a) is correct
d. Only (b) is correct

Explanation / Answer

a. both a and b are correct

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote