Posted by Micael on Tuesday, May 22, 2012 at 7:55pm.
For the first question, the loop runs 5 times, just count it on your fingers. It will display 23456
For the second question, the loop runs three times. Once when k = 1, once when k = 3, and once when k = 5.
For the third question, it will either run 5 or 6 times...I am not familiar with this syntax. If the loop will run when x = 5, then 6 times. If not, then only five.
Also, if it will run when x = 5, then the output will be:
012345
otherwise, it will be:
1234
Hope this helps!
Set k=1
While k<=5
Display k + 1
End While
k does not get updated inside of the while loop, so it will print 2 and loop forever.
Set k=1
While k<=5
k = k + 2
End While
When it hits "while k<=5", the values of k are
1,3,5,7...
So how many times does it get executed?
For x = 0 To 5
Display x
End For
By definition of the for loop, it executes 6 times and displays the 6 integers.
Related Questions
Programming - Design a program in pseudocode that calculates the amount of money...
Programming - Design a program in pseudocode that calculates the amount of money...
Computer Programming - I was wondering if someone could review my pseudocode to ...
programmning code - Is this code right? Declare Integer days, counter = 1 ...
programming logic and design - what is the output by each psuedocode segments ? ...
programming logic and design - whats is the output for each psuedocode sedment? ...
Computer Science - MATLAB - In a problem I had to create a animation of the ...
Computer Science - Cell formulas are usually displayed in the cell, while the ...
C++ - 1. while(c <= 5) { product *= c; c++; 2. while ( z > 0 ) sum...
Programming - Write a program (pseudocode) that would calculate and display the ...
For Further Reading