andy6804tw
10/12/2016 - 2:22 AM

http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=30751

#include<stdio.h>  
int main(){     
	int n,i,tot=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		if(i%3==0)tot+=i;
	}
	printf("%d\n",tot);
}