python输入两个整型数a和b,(0≤a,b≤10000),分别求出这两个数的和、差、积、商和余数。其中求商和余数时,应以较大数作为被除数。求差时,应以较大数作为被减数。除法只做整除。输出格式一行,按照题目要求得到的5个整数,中间以空格分隔。
时间: 2024-05-19 11:12:51 浏览: 51
Python 基础教程之str和repr的详解
a, b = map(int, input().split())
sum = a + b
if a >= b:
diff = a - b
prod = a * b
quo = a // b
rem = a % b
else:
diff = b - a
prod = a * b
quo = b // a
rem = b % a
print(sum, diff, prod, quo, rem)
阅读全文