View Code of Problem 18

#include<bits/stdc++.h>
using namespace std;
int kay(int n) {
	if(n==1||n==2) return 0;
	return kay(n-2)+n-2; 
}
int main() {
	int n;
	while(cin>>n) {
		cout<<kay(n)<<endl;
	}
}

Double click to view unformatted code.


Back to problem 18