what I'm trying to do is use a while loop to check userNum % 2 > 1 once it hits one i want it to stop and print out all the values of the division so for example
if 20 is user num it would generate. 20 / 2 and 10/ 2 and 5/2 and then 2/2 resulting in 1 and then stopping (integer division)
import java.util.Scanner;
public class DivideByTwoLoop {
public static void main (String [] args) {
int userNum = 0;
userNum = 20;
while ( (userNum % 2) > 1){
userNum = userNum / 2;
System.out.println(userNum );
}
System.out.println("");
return;
}
}
thats what I have so far. any help is greatly appreciated.