在本教程中,我们将讨论一个程序来查找系列9、23、45、75、113的第N个术语。
为此,我们将提供一个电话号码。我们的任务是在特定位置找到给定系列的术语。
#include <iostream>
using namespace std;
//calculating nth term of given series
int nthTerm(int N) {
return (2 * N + 3) * (2 * N + 3) - 2 * N;
}
int main() {
int N = 4;
cout << nthTerm(N);
return 0;
}
输出结果
113