c语言代码(闰年)

来源:互联网 发布:电子琴入门软件 编辑:程序博客网 时间:2024/06/07 05:57
#include<stdio.h>
#include<windows.h>
int main()
{
   int year;
   int leap;
   printf("please enter year:");
   scanf("%d",&year);
   if((year%4==0&&year%100!=0)||(year%400==0))
    leap=1;
   else
    leap=0;
   if (leap==1)
    printf("%d is a leap\n",year);
   else
    printf("%d is not a leap\n",year);
       system("pause");
   return 0;
}
  
原创粉丝点击