今天学习了如何对闰年判断
#include <stdio.h>
int main()
{
int a;
scanf("%d",&a);
if(a>=1)
{
if(a%4==0&&a%100!=0||a%400==0)
printf("Yes");
else
printf("No");
}
else
printf("Input error!\n");
return 0;
}#include <stdio.h>
int main()
{
int a;
scanf("%d",&a);
if(a>=1)
{
if(a%4==0&&a%100!=0||a%400==0)
printf("Yes");
else
printf("No");
}
else
printf("Input error!\n");
return 0;
}
运行结果如下
2016
Yes
--------------------------------
Process exited after 5.357 seconds with return value 0
请按任意键继续. . .
2015
No
--------------------------------
Process exited after 20.85 seconds with return value 0
请按任意键继续. . .
a
Input error!
--------------------------------
Process exited after 4.128 seconds with return value 0
请按任意键继续. . .