[C++] Tính S(n) = x + x^2 + x^3 + ... + x^n Ngôn ngữ: C++ Phần mềm: Visual Studio CODE: Select All #include <iostream>using namespace std;//Tính S(n) = x + x ^ 2 + x ^ 3 + ... + x^nint calSum(int X, int N){ int S = 0; int T = 1; for (int i = 1; i <= N; i++) { T = T * X; S = S + T; } return S;}int main(){ int N; cout << "Input N = "; cin >> N; int X; cout << "Input X = "; cin >> X; int result = calSum(X, N); cout << "Result = " << result << endl; system("pause"); return 0;}