Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Please help me with a simple algorithm using a while loop (http://www.go4expert.com/forums/help-simple-algorithm-using-loop-t4182/)

jb82 6May2007 21:29

Please help me with a simple algorithm using a while loop
 
set the initial value of count to 10
while (NOT (count is 0) )
write the value of count in the output window
decrease count by 1
move to the next line of the output window
write 'zero' in the output window

(a) what will be written to the output window when this algorithm is run?
(b) Suppose the second line of the algorithm were changed to read
while (count is 11)
What will be written when the modified algorithm is run?

How do I get the answers?
Many thanks jb82

abhishekshahi 31Jul2007 16:41

Re: Please help me with a simple algorithm using a while loop
 
Hi,

1)

10
9
8
7
6
5
4
3
2
1
Zero

2)

11
10
9
8
7
6
5
4
3
2
1
Zero

Do i have answered your question ?


All times are GMT +5.5. The time now is 19:21.