The age of the father and the son
Write a program that receives the age of father and son from the input and prints them (subtraction) in the output
Write a program that receives the age of father and son from the input and prints them (subtraction) in the output
let msg = 'error' alert(msg)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
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
# Get user input for father's age and son's age a = int(input("Enter the father's age: ")) # Corrected the typo in the prompt b = int(input("Enter the son's age: ")) # Prompt for son's age # Calculate the age difference d = a - b # Print the result print("Here is your result: ", d)
X=int(input("father's age: ")) Y=int(input("boy's age: ")) print(X-Y)
dadage = int(input("a: ")) sonage = int(input("b: ")) print(dadage-sonage)
# This code takes the age of the father, father and son
father_age = int(input('enter father age: '))
son_age = int(input('enter son age: '))
# In this code, the age of the father and the son is obtained
difference = father_age - son_age
# This code examines that the age is properly entered
if difference < 100 and difference > 20:
# This code prints the age of the father and son in the output
print(difference)
# If the age is wrong, the program will give
else:
print('erorr')
age_pedar = int(input("Age Pedar: "))
age_pesar = int(input("Age Pesar: "))
age_tafazol = age_pedar - age_pesar
print(age_tafazol)
tool = int(input("tool")) arz = int(input("arz")) print(tool * arz)
fatherAge=int(input("please set father age: ")) sonAge=int(input("please set son age: ")) print("minus =",fatherAge-sonAge)
Submitting answers is currently unavailable.
You must be logged in to access this section.
Login/Sign up If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.