What is the output for the following pseudocode segment? For your answer list all outputs (not just the final values of s, t, and u). Is Y output, how many times? If Z output, how many times?
What is the output for the following pseudocode segment? For your answer list all outputs (not just the final values of s, t, and u). Is Y output, how many times? If Z output, how many times?
s = 1
t = 6
u = 8
while s < t
s = s + 1
output “Y”
while s < u
output “Z”
u = u – 1
endwhile
endwhile
output s, t, u
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
Thank you! My follow up question for clarity is:
Then does "Z" output 5 times as stated in the 1st sentence of your response, or does "Z" output 6 times, as you stated at the end of your answer/explanation?
It seems to be 2 conflicting answers.