View Code of Problem 18

#include<bits/stdc++.h>

using namespace std;

int main()
{
	int i,n;
	while(cin >> n){
		i = n / 2;
		if(n < 3) cout<< 0<<endl;
		else if (n % 2 == 0)
		      cout<< i * (i -1) <<endl;
	    else 
	        cout << i *(i - 1)/2 + i * (i + 1)/2 << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 18