View Code of Problem 18

#include<stdio.h>
int main(){
	int n;
	int sum;
	int count=0;
	while(scanf("%d",&n)!=EOF){
		sum=0;
		count=0;
		for(int i=1;i<=n;i++){
			sum+=count;
			if(i%2==0){
				count++;	
			}
		}
		printf("%d\n",sum);
	}
}

Double click to view unformatted code.


Back to problem 18