Respuesta :

Answer:

public class HelloWorld{

    public static void main(String []args){

       

        int userNum = 20;

       

        while(userNum!=1){

            userNum = userNum/2;

             System.out.print(userNum+" ");

        }

    }

}

Explanation:

Create the main function and declare the variable userNum with value.

then, use a while loop and it run until the userNum not equal to one when it become equal to 1 the while loop terminate.

Inside the loop, divide the userNum by 2 and then assign to userNum and this process continue until condition  true.

for example:

userNum = 20

userNum =20/2=10

then, 10/2=5

5/2=1

after that condition false. and while loop terminate.

Answer:

while(userNum > 1){

        userNum = userNum /2;

        System.out.print(userNum+" ");

     }

Explanation:

Probably don't need the print statement, but it doesn't cause an error.

Ver imagen DarthVaderBarbie