View Code of Problem 18

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	while(cin>>n)
	{
		int s=0,k=0;
		for(int i=1;i<=n;i++)
		{
			s+=k;
			if(i%2==0)
			k++;
		}
		cout<<s<<endl;
	}
	return 0;
	
	}

Double click to view unformatted code.


Back to problem 18