a) Perform a DRY RUN on the algorithm below using the data provided. Lay out the results of the dry run in
TABLE FORMAT with a column for each variable.
C = 0
D = A
If B > D
D = B
C = C + 1
Until B = 0
Print D, B, C
DATA: 4, 6, 3, 7, 8, 5, 3, 9, 2, 0, 5, 1
The table headers should show each variable and the condition(s) being tested. Show the value of each
variable as it changes.
b) Describe the purpose of the program.
c) Would the final output be different if the first data input was changed to 7 instead of 4?
d) What would be the final value of D if the 9 in the list was replaced with 0?
Jump to Post
OK, so that's your homework. What part of it are you having a problem with?
It's not too difficult. The instructions are pretty clear.
It might help you to understand the algorithm if you indent the pseudo-code in the same way that you would indent C++ code:
Jump to Post
I don't think I could make it any easier without actually doing your homework for you. And let's make this clear: I'm NOT going to do your homework for you. That's not what Daniweb is about! The community here exists to help guide you, not do your homework for you.…
All 6 RepliesReply to this topic
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.