函数判断year是不是润年

#include
int leap(int *year)
{
    int l=0;
    if(((*year%4==0)&&(*year%100!=0))||(*year%400==0))
        return 1;
    else
        return 0;
}
int main()
{
    int year=0;
    int l=0;
    printf("please enter the year>");
    scanf("%d",&year);
    l=leap(&year);
    if(l==1)
        printf("%d is leap year!\n",year);
    else
        printf("%d is not leap year!\n",year);
    return 0;
}

你可能感兴趣的:(c编程)