a,b=eval(input())
if a%b==0:
print("{}是{}的因数。".format(b,a))
elif:
print("{}不是{}的因数。"
输入两个非0自然数a和b,判断b是否是a的因数(可以通过a除以b是否能除尽来判断),输出判断结果;如果输入的数据小于等于0或者为小数(不考虑其它错误输入),给出数据错误提示。
提示:输入数据时,请使用
try:
a, b = map(lambda x: float(x), input().split())
except IOError as e:
print(str(e))
if not a % b:
print("{}是{}的因数。".format(b, a))
else:
print("{}不是{}的因数。".format(b, a))
while True:
print("输入数据时,请使用逗号隔开,例如:6,30:\n")
a, b = eval(input())
if a <= 0 or b <= 0:
print("请勿输入负数或0")
elif isinstance(a,float) or isinstance(b,float):
print("请勿输入小数")
else:
if a % b == 0:
print("{}是{}的因数。".format(b, a))
else:
print("{}不是{}的因数。".format(b, a))
break