# Answer to Question #27866 in C++ for anahid

Question #27866

Write a c++ program for the sequence, ∑_(i=1)^n=2^(3^i )/i=2^(3^1 )/1+2^(3^2 )/2+2^(3^3 )/3+⋯+2^(3^n )/n if the manual input is n.

Expert's answer

#include <iostream>

using namespace std;

//main function

int main()

{

int n=0;

cout<<"Enter n: ";

cin>>n;//enter n

int sum=0;

for(int i=1;i<n;i++){

sum+=pow(2,(pow(3.0,i)/i));

}

//show result

cout<<"Sum = "<<sum;

cin>>n;//delay

return 0;

}

using namespace std;

//main function

int main()

{

int n=0;

cout<<"Enter n: ";

cin>>n;//enter n

int sum=0;

for(int i=1;i<n;i++){

sum+=pow(2,(pow(3.0,i)/i));

}

//show result

cout<<"Sum = "<<sum;

cin>>n;//delay

return 0;

}

## Comments

## Leave a comment