Here are some programs for you to write for practice:
- Write a program that inputs a number and prints out if it is outside of the range of 1 to 100
- Modify the first program so that it prints out a specific error message of too low or too high
- Modify the first program to repeatedly ask for a new value while the number is outside of the range of 1 to 100
- Modify the third program to repeatedly ask for a new value while the number is outside of the range of 1 to 100 and print out a specific message of too high or too low
- Create a new program that uses a for loop to give the user the numbers from 1 to 100 that are evenly divisible by a value that the user inputs.
A solution
- Create a program that generates the following using nested for loops:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
A solution
- Create a program that repeatedly provides the user with three options and simply prints out which option was entered . Use a switch and do loop.
A solution