The rice and chessboard case = "Oh emperor, my wishes are simple. I only wish for this. Give me one grain of rice for the first square of the chessboard, two grains for the next square, four for the next, eight for the next and so on for all 64 squares, with each square having double the number of grains as the square before."

I have to use a while or do loop to replicate this but only upto the square that will contain a 100 grains of rice. (It is the 8th square where I hit 128 grains of rice.)

I have defined an integer as 1 and I have been trying to use *2 in the while loop but it only multiplies 1 by 2 an endless number of times.

I tried this:

int i = 1;

while (i<=64) {

int l = ((i)*2);