Cho dãy: 0, 9, 22, 39, 60, 85, 114, 147... Tìm số hạng thứ N.
Công thức
T_N = 2*N^2 + 3*N - 5.
Mã nguồn C++
#include <iostream>
using namespace std;
int findNTerm(int N) {
return 2*N*N + 3*N - 5;
}
int main() {
int N = 8;
cout << N << "th term of the series is " << findNTerm(N);
return 0;
}
Đầu ra
8th term of the series is 147