Respuesta :
Answer:
Following are the Program in Java Language
import java.util.*; // import package
public class Main // Main class
{
public static void main (String[]args) // main method
{
int userNum; // variable decleration
Scanner sc2=new Scanner(System.in); // creating the instance of scanner class
System.out.print(" Enter the number:");
userNum=sc2.nextInt(); // Read the number by user
while(userNum/4 >= 2) // iterating the while loop
{
userNum = userNum/4;
System.out.print(userNum);// display number
System.out.print(" ");
}
}
}
Output:
Enter the number:160
40 10 2
Explanation:
Following are the description of the Program
- Read the number in "userNum" of int type by using the instance of scanner class.
- Iterating the while loop divided by the until the reaching value of less then 2
- In that while loop print the value of userNum.
Answer:
while(userNum > 1){
userNum = userNum /2;
System.out.print(userNum+" ");
}
Explanation:
