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.
Input A
C = 0
D = A
Repeat
Input B
If B > D
D = B
endif
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?
Ivzirnalsradeys
0
Newbie Poster
Recommended Answers
Jump to PostOK, 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 PostI 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 Replies
JasonHippy
739
Practically a Master Poster
Ivzirnalsradeys
0
Newbie Poster
JasonHippy
739
Practically a Master Poster
Ahsan ilyas
0
Newbie Poster
tinstaafl
1,161
Posting Maven
aanyadsouza
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.