تفاضل سن پدر و پسر
برنامه ای بنویسید که سن پدر و پسری را از ورودی دریافت کند و تفاضل (تفریق) آنها را در خروجی چاپ کند
👨💻 6 ساعت قبل کاربر ناشناس این تمرین رو مشاهده کرد
برنامه ای بنویسید که سن پدر و پسری را از ورودی دریافت کند و تفاضل (تفریق) آنها را در خروجی چاپ کند
# این کد سن پدر و پدر و پسر را میگیرد
father_age = int(input('enter father age: '))
son_age = int(input('enter son age: '))
# در این کد هم تفاضل سن پدر و پسر به دست می آید
difference = father_age - son_age
# این کد برسی میکند که سن ها درست وارد شده است
if difference < 100 and difference > 20:
# این کد تفاضل سن پدر و پسر را در خروجی چاپ میکند
print(difference)
# اگر سن ها اشتباه وارد شوند برنامه ارور میدهد
else:
print('erorr')
#دریافت سن پدر و پسر از کاربر
dad = int(input("Enter yor age dad :"))
boy = int(input("Enter yor age boy :"))
#"محاسبه"تفریق
t = dad - boy
#پرینت جواب محاسبه شده
print("minus =" , t)
# 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)
# ابتدا سن پدر و پسر را از کاربر میپرسیم
a = int (input ("sen pedar :")
b = int (input ("sen pesar :")
# سپس سن پسر را از ست پدر کم میکنیم تا تفاضل آن بدست بیاید
print ( a - b )
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)
#مقایسه سن پدر و پسر
pedar=float(input("sen pedar:"))
pesar=float(input("sen pesar:"))
print(pedar-pesar)
input("khoroog")
#گرفتن سن پدر از کاربر
father_age = int(input("how old is your father? "))
#گرفتن سن پسر از کاربر
son_age = int(input("how old are you? "))
#محاسبه ی اختلاف سن پدر و پسر
x = father_age - son_age
#چاپ اختلاف سن پدر و پسر در خروجی
print("your father is" , x , "years bigger than you.")
جوابت را با Markdown بنویس و ثبت کن
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نامتوضیح کوتاهی بنویسید تا تیم بررسی کند.