/*
Write a function with
Input: an integer n greater than 1.
Output: the sum of the even integers from 1 to n.
*/


#include <iostream>
#include <string>
using namespace std;
int sum(int n);
int main()
{
	int n;
	cout << "Enter an integre > 1: ";
	cin >> n;
	if (n > 1)
		cout << sum(n) << endl;
	else
		cout << "Invalid number (must be > 1).\n";
	return 0;
}

int sum(int n)
{
	int i, s = 0;
	for (i = 2; i <= n; i = i + 2)
		if (i % 2 == 0)
			s += i;
	return s;
}



