Problem 18

Age in Five Years

  1. Ask the user for their name. -Then display their name to prove that you can recall it.
  2. Ask them for their age.
    • Then display what their age would be five years from now.
    • Then display what their age was five years ago.
Hello.  What is your name? Percy_Bysshe_Shelley

Hi, Percy_Bysshe_Shelley!  How old are you? 34

Did you know that in five years you will be 39 years old?
And five years ago you were 29! Imagine that!
Hello.  What is your name? Gramps

Hi, Gramps!  How old are you? 87

Did you know that in five years you will be 92 years old?
And five years ago you were 82! Imagine that!

◄ 17: More User Input of Data 19: A Dumb Calculator ►



Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell

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