CodeSolved

A comprehensive source of programming questions and exercises

Calculate User Birthday

Practice Easy 54/ Download 7963 Views Most popular

Write a program that gets the user's age from the input and calculates and prints the user's birthday

36 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
age=int(input('age:'))
a=1403
b=age-a
print('sale tavalode shoma:',b)
Maryam.n Download Python
from datetime import date 
age = int(input(f"What's your age?"))
today = date.today()
current_year=today.year
birth_year=current_year-age 
print(birth_year)
Farbod.313 Download
from datetime import datetime
age = int(input("how old are you?"))
current_year = datetime.now().year
birth_year = current_year - age
print(f"you were born at {birth_year}")
Roghaye.m Download Python
from datetime import datetime as gdt
from jdatetime import datetime as jdt
age = int(input('Enter your age: '))
print(f'Gregorian birthday: {gdt.today().year - age:2d} - Jalali birthday: {jdt.today().year - age:2d}')
User 251 Download Python
from datetime import datetime

# Get User Age from Input
age = int(input("لطفاً سن خود را وارد کنید: "))

# Calculate the year of birth
current_year = datetime.now().year
birth_year = current_year - age

# Birthday printing
print("سال تولد شما برابر است با:", birth_year)
Mma123 Download Python
from datetime import datetime

v= eval(input("pless inter you birthday day:"))
m= eval(input("pless inter you birthday mons:"))
y= eval(input("pless inter you birthday year:"))

d = datetime.now()
D, M, Y = d.day, d.month,  d.year

newday = D-v
if newday <0 :
    newday = -newday
    
newmons = M-m
if newmons < 0 :
    newmons = -newmons
    
print(f"{Y-y} year and {newmons} mons {newday} day")
Nianik Download Python
<< Previous page 1 2 4 Next page >>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close