Assignment
1. [prob1.c] [80%] Your computer pretends to be 20 years older than you. Create a program that asks
for your age, adds twenty years to your age, and outputs the following "smiley face"
(^_^)
Your program should output the following 5 lines:
- Line 1: Ask user to input age, and user inputs age value XX
- Line 2: Output smiley face
- Line 3: Output text, I am your computer! My name is SMILEY.
- Line 4: Output text, I am YY years old. You are 20 years younger than me.
- Line 5: Output text, See you next time. Bye!
Where XX is a user-input value and YY is a calculated value based on that user-input value.
Below is an example of your programs output, where the number 21 is users input and the number
41 is a calculated value based on that user-input value.
In your report, discuss the limitation of the input value. What happens if the user inputs a value of
the following cases?
i) A negative number (e.g. -5)
ii) An excessively large number (e.g. 98
for your age, adds twenty years to your age, and outputs the following "smiley face"
(^_^)
Your program should output the following 5 lines:
- Line 1: Ask user to input age, and user inputs age value XX
- Line 2: Output smiley face
- Line 3: Output text, I am your computer! My name is SMILEY.
- Line 4: Output text, I am YY years old. You are 20 years younger than me.
- Line 5: Output text, See you next time. Bye!
Where XX is a user-input value and YY is a calculated value based on that user-input value.
Below is an example of your programs output, where the number 21 is users input and the number
41 is a calculated value based on that user-input value.
In your report, discuss the limitation of the input value. What happens if the user inputs a value of
the following cases?
i) A negative number (e.g. -5)
ii) An excessively large number (e.g. 98