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?

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter6: Looping
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

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

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

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.

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Fundamentals of Boolean Algebra and Digital Logics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr