year = int(input("请输入年份:"))
if year%400 == 0 or (year%4 == 0 and year%100 != 0):
print("是闰年")
else:
print("不是闰年")
python编写程序,运行后用户输入 4 位整数作为年份,判断其是否为闰年。如果年份能被 400 整除,则为闰年;如果年份能被 4 整除但不能被 100 整除也为闰年。
最新推荐文章于 2023-02-17 20:57:34 发布