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 one if statement (no else) and one for loop.

Your name: gump

gump
gump
gump
gump
gump
gump
gump
gump
gump
gump

 

Your name: Mitchell

Mitchell
Mitchell
Mitchell
Mitchell
Mitchell


©2013 Graham Mitchell

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