main()
{
int i,sum=0;
for(i=1;;i++)
{sum+=i;
if(sum>500)
{pritnf("n=%d,sum=%d",i-1,sum-i);
break;
}
}
}
main()
{
int n,i,sum=0;
printf("enter a integer number:\n");
scanf("%d",&n);
if(n<=0){printf("data error!retry!");scanf("%d",&n);}
for(i=2;i<=n+1;i+=2)
sum+=i;
printf("sum=%d",sum);
getch();
}