
Csci 1301, Lab 6
2007.01.31/02.04
LoopLab.java
1
In this lab youāll be getting familiar with loops. Part 2 will involve a simple print
statement. Part 3 will require you to use an if statement (or some clever coding). Parts
3 and 4 will get you started using expressions inside a loop.
1. Input two int values from the user. These will serve as upper and lower bounds
for a loop.
2. Use a while loop to print out all values greater than or equal to the lower
bound but less than the upper bound. Use the print statement and the ā\tā
character to avoid printing each number on its own line.
3. Use a for loop to do almost the same thing. Except only print out the even
values. Hint: All even values have a remainder of 0 when divided by 2.
4. Finally, use a loop of your choice to print out the squares of all of the numbers
between 1 and 100. Remember, donāt āhard-codeā in any values here. Create
constants (āfinal variablesā) instead.