Refresher Challenge

This assignment is almost the same as A Refresher.

Write a program that prompts the user for a name. Then display that name ten times using a loop. However, if the name given is "Mitchell", display it only five times.

So here's the challenge: write the program using only:

I recommend using a for loop, but a while loop is okay as long as you only have one of them.

Your name: gump

gump
gump
gump
gump
gump
gump
gump
gump
gump
gump

 

Your name: Mitchell

Mitchell
Mitchell
Mitchell
Mitchell
Mitchell



©2003–2016 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License