year = input('请输入年份')
if not year.isdigit():
year = int (input('输入错误,请输入整数!'))
else:
if int(year) % 400 == 0:
print(year+' 是闰年')
else:
if (int (year) % 4 == 0)and(int (year) % 100 != 0):
print(year+' 是闰年')
else:
print(year+' 不是闰年')
input("Prease <enter>")
写一个程序,判断给定年份是否为闰年。
最新推荐文章于 2024-06-19 11:41:47 发布