Extra Practice Questions on For and While Loops

  1. Write a piece of code that keeps asking the user for input until they enter the letter 'a'.

  2. Write a piece of code that prints out all even numbers between 2 and 200.

  3. Write a piece of code that counts down from 1000 to 1.

  4. Write a piece of code that prints the string "1*2*3*4*...*99*100" (i.e. all numbers from 1 to 100 separated by *'s)

  5. Write piece of code that takes an array of strings and adds '!' to the end of each string in the array.