题目描述
经典编程。输入年号,判断并输出该年是否闰年。所谓闰年,是指能被4整除,但不能被100整除;或能被400整除的年份。
输入
输入年号
输出
是否为闰年,是输出yes,否则输出no
样例输入
2008
样例输出
yes
程序:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int Y;
scanf("%d",&Y);
if ((Y%4==0)&&(Y%100!=0)||(Y%400==0))
printf("yes");
else
printf("no");
return 0;
}
结果:
2008
yes
Process returned 0 (0x0) execution time : 2.478 s
Press any key to continue.