1)闰年定义
闰年是指公历年份中能够被4整除但不能被100整除,或者能够被400整除的年份。
2)编程
# 闰年判定
years = int(input("请输入年分:"))
def rn(years):
if years % 4 == 0 and years % 100 != 0 :
print(str(years)+"年是闰年")
else:
print(str(years) + "年是平年")
rn(years)
1)闰年定义
闰年是指公历年份中能够被4整除但不能被100整除,或者能够被400整除的年份。
2)编程
# 闰年判定
years = int(input("请输入年分:"))
def rn(years):
if years % 4 == 0 and years % 100 != 0 :
print(str(years)+"年是闰年")
else:
print(str(years) + "年是平年")
rn(years)