CodeSolved

A comprehensive source of programming questions and exercises

Calculate the year of 100 years

Practice Easy 1015/ Download 679 Views

Write a program that gets the user's age and calculates what year the user (solar and AD) is 100 years old.

10 Answers

# Getting
age = int(input("age :"))
sh = int(input("sall shamsi :"))
me = int(input("sall meladi :"))

# Calculate and print on the output
age = 100 - age
sh += age
me += age

print("shamsi {} , meladi {}".format(sh,me))
Hossien Download Python
age = int(input("please enter your age: "))
print(f"shoma dar sale {2024 + age} miladi va sale {1402 + age} shamsi , sad sale mi shavid.")
# Calculations
def im_100_years_old(age, now):
    x = 100 - age
    y = now + x
    print('You will be a hundred years old in :')
    print(y)

# Variables
age = int(input('how old are you ? : '))
now = int(input('what is this years? :'))

# Implementation of the program
im_100_years_old(age, now)                    
User 131 Download Python
import time
current_year = int(time.ctime()[20:]) - 621
age = int(input("Enter your age: "))
print(f'The year when you will be 100: "{current_year+(100-age)}"')
User 362 Download Python
x = int(input("enter age :"))
x -= 100
x = abs(x)
y = x + 2024 
print("you will be 100 years old at",y)
Ali.r.h.z Download Python
year =  int(input('enter your birthyear : '))
month = input('enter your birthmonth : ')
day = input('enter your birthday : ')
print(year + 100 , month , day)
Zahra1392 Download Python
x = int(input('age:'))
y = 100
a = int(input('what is this years ?:'))
print('one hundred years old in:',y-x+a)
User 1705 Download Python
a=int(input("age:"))
b=int(input("yers sham:"))
c=int(input("yers mila:"))
d=100-a
print(b+d,c+d)
age=int(input("enter your age:"))
n=100-age
result=n+2024
result_2=n+1403
print(f"you will be 100 years old at {result} AD and {result_2} of solar year.")
from datetime import datetime
import jdatetime

age = int(input("Please enter your age: "))

current_ad_year = datetime.now().year
current_shamsi_year = jdatetime.date.today().year

print(f"AD year your age = 100 => {current_ad_year + (100 - age)}")
print(f"shamsi Year your age = 100 => {current_shamsi_year + (100 - age)}")
Behcoder Download Python

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close