wyh042868 @ 2021-05-26 23:25:00
#include<stdio.h>
int judge(int x)
{
if(x%4==0&&x%100!=0)
return 1;
if(x%400==0)
return 1;
return 0;
}
main()
{
int x,y,i,count=0;
scanf("%d %d",&x,&y);
for(i=x;i<=y;i++)
if(judge(i)) count++;
printf("%d\n",count);
for(i=x;i<=y;i++)
if(judge(i)) printf("%d ",i);
}
这个主函数在后的是满分,为啥后面我将主函数放到后面就说我main那一行不对
#include<stdio.h>
int judge(int)
void main()
{
int x,y,i,count=0;
scanf("%d %d",&x,&y);
for(i=x;i<=y;i++)
if(judge(i)) count++;
printf("%d\n",count);
for(i=x;i<=y;i++)
if(judge(i)) printf("%d ",i);
}
int judge(int x)
{
if(x%4==0&&x%100!=0)
return 1;
if(x%400==0)
return 1;
return 0;
}
by ud2_ @ 2021-05-26 23:51:26
分号。
by Coros_Trusds @ 2021-05-27 00:09:07
@wyh042868
#include<stdio.h>
int judge(int) ;//注意加分号!!!
void main()
{
int x,y,i,count=0;
scanf("%d %d",&x,&y);
for(i=x;i<=y;i++)
if(judge(i)) count++;
printf("%d\n",count);
for(i=x;i<=y;i++)
if(judge(i)) printf("%d ",i);
}
int judge(int x)
{
if(x%4==0&&x%100!=0)
return 1;
if(x%400==0)
return 1;
return 0;
}
OK了
by wyh042868 @ 2021-05-27 19:02:54
太感谢了