I tried squaring an int and got a bit of code on a previous forum but my result is always 2048. This is a little drill in a book. There are 64 spaces on a chess broad and the inventor says to the Emperor, "I want 2 grains of rice for each space." 2 for the first, 4 for the second, etc. Could I get a bit of help with this?
I just copied the code from something similar on squaring. Sorry for my misinterpretation. The books says it calls for doubling I thought it was squaring. Is there anyway to do this in a for loop?
There is more than one way, choose whichever you prefer. For example add the value to itself to give the new value. Or multiply the value by 2 to give the new value.