While Loop Practice Exercises

Write individual programs to accomplish the following tasks:

 

  1. (5.1) Write a program that allows a user to input as many numbers as the user wants to enter and then outputs the number of values that were entered.
  2. (5.2) Write a program that asks how many numbers a user wants to add and then allows those numbers to be entered. After all the numbers are entered, the program outputs the sum.
  3. Write a program with a while loop that prints to the console the odd numbers from 0 to 100, each on its own line.
  4. Write a program with a while loop that prints to the console the even numbers between 0 and 100 in decreasing value.
  5. Write a program that uses two nested while loops to print to the console 5 rows (lines) of asterisks. The number of asterisks in each row should be retrieved from the user.
  6. Write a program that uses two nested while loops to set the color of a rectangular region of pixels to black. The picture to be modified should be your own class picture, and the region should be the area covering your eyes.