C语言60分求大佬教!!!

P5737 【深基7.例3】闰年展示

CY666 @ 2020-09-29 22:25:10

#include<stdio.h>
int main()
{
    int x,y;
    int i;  
    int num=0;
    scanf("%d%d",&x,&y);
    for(i=x;i<y;i++)
    {
        if((i%100!=0&&i%4==0)||i%400==0)
        num++;  
    }
    printf("%d\n",num);
    for(i=x;i<y;i++)
    {
     if((i%100!=0&&i%4==0)||i%400==0)
     printf("%d ",i);   
    }
    return 0;
}

by iorit @ 2020-09-29 22:27:38

@CY666 y可以取到


by Im_iceman @ 2020-10-04 10:15:54

<y改为<=y


|