def showmaxfactor(num):
count=num//2
while count>1:
if num%count==0:
print('%d的最大约数为%d'%(num,count))
break
count-=1
else:
print('%d是素数'%num)
num=int(input('请输入一个数字:'))
showmaxfactor(num)
try:
with open('date.txt','w') as f:
for each_line in f:
print(each_line)
except OSError as reason:
print('出错啦:'+str(reason))