# 利用除法判断 /while True:
year = int(input("请输入年份"))
if year !=0:
break
print("请输入格式正确的年份")
if (year/400==int(year/400)) or ((year/4==int(year/4)) and (year/100 !=int(year/100))):
print("%d年是闰年" % year)
else:
print("%d年不是闰年" % year)
# 利用求余操作%
year=int(input("请输入一个年份:"))
if year%400 ==0 or (year%4==0 and year%100 != 0):
print("%d年是闰年" % year)
else:
print("%d年不是闰年" % year)
|
|