闰年分为普通闰年和世纪闰年。
普通闰年:能被4整除但不能被100整除的年份为普通闰年。(如2004年就是闰年,1999年不是闰年);
世纪闰年:能被400整除的为世纪闰年。(如2000年是闰年,1900年不是闰年);
闰年(LeapYear)是为了弥补因人为历法规定造成的年度天数与地球实际公转周期的时间差而设立的。补上时间差的年份为闰年。闰年共有366天(1-12月分别为31天,29天,31天,30天,31天,30天,31天,31天,30天,31天,30天,31天)。
1950-2050年间的闰年:1952、1956、1960、1964、1968、1972、1976、1980、1984、1988、1992、1996、2000、2004、2008、2012、2016、2020、2024、2028、2032、2036、2040、2044、2048。
#include<stdio.h>
int main()
{
int a,y;
printf("input the year:");
scanf("%d",&y);
if (y%4 == 0)
{
if (y%100 == 0)
if (y%400 == 0)
a = 1;
else
a = 0;
else
a = 1;
}
else
a = 0;
if (a = 1)
printf("%d is leap year!\n",y);
else
printf("%d is common year!\n",y);
return 0;
}