CodeSolved

Solved Programming Questions & Exercises

The age of the father and the son

Practice Easy 55/ Download 2731 Views

Write a program that receives the age of father and son from the input and prints them (subtraction) in the output

59 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.
# 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)
Dani.nejad Download Python
X=int(input("father's age: "))
Y=int(input("boy's age: "))
print(X-Y)
Farbod.313 Download Python
dadage = int(input("a: "))
sonage = int(input("b: "))
print(dadage-sonage)
Akams Download Python
# 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')

Amirsaleh Download Python
age_pedar = int(input("Age Pedar: "))
age_pesar = int(input("Age Pesar: "))
age_tafazol = age_pedar - age_pesar
print(age_tafazol)
Awlizf Download Python
tool = int(input("tool"))
arz = int(input("arz"))
print(tool * arz)
User 1437 Download Python
fatherAge=int(input("please set father age: "))
sonAge=int(input("please set son age: "))
print("minus =",fatherAge-sonAge)
Saeeda33 Download Python
<< Previous page 1 2 6 Next page >>

Submit answer

Submitting answers is currently unavailable.

×
×
Close