经典例题:鸡兔同笼
#include<stdio.h>
int main()
{
int y,x;
while(scanf("%d",&y)!=EOF)
{
if(y%4==0)
{
if(y%100==0)
{
if(y%400==0)
{
x=1;
}
else x=0;
}
else x=1;
}
else x=0;
if(x==1)
printf("yes\n");
else
printf("no\n");
}
return 0;
}
经典例题:3,7倍数之和
#include<stdio.h>
int main()
{
int n,x,s=0;
while(scanf("%d",&n)!=EOF)
{
s=0;
for(x=1;x<=n;x++)
{
if(x%21==0)
s=s+x;
}
printf("%d\n",s);
}
return 0;
}