闰年相关的问题v3.0——计算有多少闰年

题目内容:

从键盘输入你的出生年和今年的年份,编程判断并输出从你的出生年到今年之间中有多少个闰年。


#include
main()
{
    int b,t,n,c;
    printf("Input your birth year:");
    scanf("%d",&b);
    printf("Input this year:");
    scanf(" %d",&t);
    c = 0;
    for (n = b;n<=t;n++)
    {
        if (n % 4 ==0 && n % 100 != 0 || n % 400 == 0)
            {
                printf("%d\n",n);
                c++;
             }
    }
    printf("count=%d\n",c);
}

你可能感兴趣的:(c)