#include
int main() {
int i,n,sum;
printf("n(0 to quit) = ");
while(scanf("%d",&n) == 1 && n) {
sum = 0;
for(i = 1; i <= n; ++i)
if(i % 3) sum += i;
printf("sum = %d\n",sum);
printf("n(0 to quit) = ");
}
return 0;
}
#include
int main(){
int n,i=0;
int sum=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%3!=0) sum+=i;
}
printf("sum=%d",sum);
return 0;
}
#include
void main()
{ int i,n,s;
s=0; scanf("%d",&n);
for ( i=1;i<=n;i++ ) if ( i%3 ) s+=i;
printf("%d\n",s);
}