View Code of Problem 18

#include <iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		int k=0,t=0;
		for(int i=1;i<=n;i++){
			t+=k;
			if(i%2==0)
				k++;
		}
		cout<<t<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 18