posted 15 years ago
I am trying to calculate 2^n with a for loop and am having some difficulties. My program uses a loop to generate numbers 1-20 which are then used to be n.
So if n = 3 (2^3) it should calculate 2*2*2, if n = 5 (2^5) it should calculate 2*2*2*2*2. But it does not do that, not sure what it does. It's the method all the way on the bottom that is giving me a hard time. Can someone help?