求助

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

0Aurora0 @ 2022-03-18 16:24:31

#include<stdio.h>
#define YEAR 1500
int judge(int num);
int main(void)
{
    int x,y,n,m,l;
    int yes[YEAR];
    scanf("%d %d",&x,&y);
    for(n=x,m=0;n<=y;n++);
        if(judge(n))
            yes[m++]=n;
    printf("%d\n",m);
    for(l=0;l<m;l++)
        printf("%d ",yes[l]);
    return 0;
}
int judge(int num)
{
    if(num%400==0||(num%4==0&&num%100!=0))
       return 1;
    else
       return 0;
}

by 编码落寞 @ 2022-03-18 16:44:16

@0Aurora0

 for(n=x,m=0;n<=y;n++);

多个分号


by 0Aurora0 @ 2022-03-18 16:47:24

@编码落寞 谢谢


|