View Code of Problem 18

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

Double click to view unformatted code.


Back to problem 18