How can I make this power program?

Write a program to print the following output by calculating the result.
2^1 , 4^3, 6^5, 8^5, … , n^(n-1)
Where n is an even number.

I can't make this. Just give me hints on making this program. Please do not right down the code.

And I'm a newbie, the only library I know is <iostream>.
I'm also aware of arrays, the 3 types of loops(while, for, do-while), if-else and of-course the arithmetic functions too.
Basically you only need a loop and pow function.
http://www.cplusplus.com/reference/cmath/pow/
2^1 , 4^3, 6^5, 8^5


Shouldnt it be 8^7?

It's quite simple. Create two integer variables. Initialize the first one to 2, and the second one to 1. And then use a loop that run a number of times, while increasing n by 2 each iteration, which is what is happening here - 2^1 , 4^3, 6^5, 8^7.

Here is how to do to the power of in c++ - http://en.cppreference.com/w/cpp/numeric/math/pow

std::pow(2,10) means 2 to the power of 10. 2^10
Topic archived. No new replies allowed.