View Code of Problem 610

#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int arr[11];
	arr[1] = 1;
	for (int i = 2; i <= 10; i++) {
		arr[i] = pow(i - 1, 2) + 1;
	}
	int n;
	while (cin >> n) {
		cout << arr[n] << endl;
	}
	
	return 0;
}

Double click to view unformatted code.


Back to problem 610