How print this series in while loop
square root 1 2 4 8 16 32 64 128..........
and
cube root 2 8 24 72........

by writing a loop and adding a print statement in it:

step 1:
highBorder = readInHighBorder
step 2:
counter = 1
step 3:
while ( counter < highBorder ){
squareRoot = calculateTheSquareRootOfCounter
printSquareRoot
cubeRoot = calculateTheCubeRootOfCounter
printCubeRoot
add1ToCounter
}

I'm assuming you're doing this to learn Java, so this should get you started:

int counter = 0; // Declare your variables
int value = 1;
int max = 10; // You can define ("hard code") this, or read it in
while(counter < max) {
	System.out.println(value + " "); // This handles printing
	value = value * 2;
	counter++; // This will track how many numbers have already been printed
}

You can use that as a basis for figuring out the cubic part. The mechanics are essentially the same.

I'm assuming you're doing this to learn Java, so this should get you started:

int counter = 0; // Declare your variables
int value = 1;
int max = 10; // You can define ("hard code") this, or read it in
while(counter < max) {
	System.out.println(value + " "); // This handles printing
	value = value * 2;
	counter++; // This will track how many numbers have already been printed
}

You can use that as a basis for figuring out the cubic part. The mechanics are essentially the same.

two remarks:
1 -> don't spoon feed code.
2 -> if you feel the need to spoon feed code anyway, make sure your code makes sense. I doubt you'll find the square root of 25 by value= value*2

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.