Quick Counting Loop Problems:

1) Print the numbers 1 to 10

2) Change # 1 to print the numbers and add them as you go, printing the running total.

3) Change #2 to print the sum of all at the end.

4) Change #3 to not print the running total, just the list of numbers and the total

5) Change #4 to multiply every number by 5 before adding it to the total

6) Print the numbers 10 to 1 and then print the total of all these numbers.

7) Print Hello World 5 times

8) Repeat 5 times:  123 Hello World

* Use a loop to print the 1,2,3

9) Print:

123 Hello World
123456 Hello World
123456789 Hello World
12345678910112 Hello World
123456789101112131415 Hello World

* Use one outer loop to print 5 lines and an inner loop to print the numbers

10) Reverse the loop above, to print:

123456789101112131415 Hello World
12345678910112 Hello World
123456789 Hello World
123456 Hello World
123 Hello World

* Use one outer loop to print 5 lines and an inner loop to print the numbers


 

11) Change the inner loop above to print spaces instead of numbers:

                        Hello World
                   Hello World
              Hello World
        Hello World
   Hello World

* Use one outer loop to print 5 lines and an inner loop to print the numbers

12) Interest Program

13) Write a program that raises 2 to a power of 10 using a loop.

14) Change the dice homework to throw the dice up to 20 throws or when the total is 9. Then, print the total number of throws at the end.

15) Change #14 to consider that a total of 9 before 20 throws is a win, and not reaching a 9 in 20 throws is a loss. The, play that game 5 times and calculate the wins and losses. Then, calculate the win percentage.