/* Write a program segment that reads a sequence of integers until a 0 is encountered. For each number read, output the number of times the number can be divided by 2 before you get 0. For example, if the input is: 2 9 -7 4 -3 0 The code will read in all the integers, and produce the following output: 2 4 3 3 2 */ import java.util.Scanner; public class HW4q2c { public static void main(String[] args) { Scanner kb=new Scanner(System.in); int userInt=kb.nextInt(); while (userInt!=0) { int countDiv=0; while (userInt>0) { userInt=userInt/2; countDiv++; } System.out.println(countDiv); userInt=kb.nextInt(); } } }