Advertisements
Advertisements
प्रश्न
Write a program that asks the user to enter their name and age. Print a message addressed to the user that tells the user the year in which they will turn 100 years old.
संक्षेप में उत्तर
Advertisements
उत्तर
Program:
#Program to tell the user when they will turn 100 Years old
name = input("Enter your name: ")
# age converted to integer for further calculation
age = int(input("Enter your age: "))
#calculating the 100th year for the user considering 2020 as the current year
hundred = 2020 + (100 - age)
#printing the 100th year
print("Hi", name,"! You will turn 100 years old in the year", hundred)
OUTPUT:
Enter your name: John
Enter your age: 15
Hi John! You will turn 100 years old in the year 2105shaalaa.com
Operators - Arithmetic Operators (-,+,*,/,%)
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
