【Learn C】 判断闰年

#include <stdio.h>
int main()
{
    int year;
    scanf("%d", &year);

    if (year % 4 == 0)
    {
        if (year % 100 != 0)
        {
            printf("Yes");
        }
        else
        {
            if (year % 400 == 0)
            {
                printf("Yes");
            }
            else
            {
                printf("No");
            }
        }
    }
    else
    {
        printf("No");
    }
    return 0;
}

山东理工 OJ  1580

猜你喜欢

转载自blog.csdn.net/Cherishlife_/article/details/81364414