#D:\编程\Python\maths.py
def mydef(): while True: try: a = 1 b = 0 c = input('请输入一个数字:') c = eval(c) d=c**0.5 e=int(d) for i in range(e): if c % a == 0: b += 1 if a < c: a += 1 if b >= 2: print('这是一个合数') else: print('这是一个质数') except: print("错误") exit()
while True: try: a = 1 b = 0 c = input('请输入一个数字:') c = eval(c) d=c**0.5 e=int(d) for i in range(e): if c % a == 0: b += 1 if a < c: a += 1 if b >= 2: print('这是一个合数') else: print('这是一个质数') except: print("错误") exit()