# 将数字变成零的操作次数

/**
 * @author your name
 * @date 上午9:06
 * @Description the description of this class
 **/
class Solution1342 {
    public int numberOfSteps(int num) {
        int res = 0;
        while (num != 0) {
            if (num % 2 == 0) {
                num /= 2;
            } else {
                num--;
            }
            res++;
            System.out.println(num);
        }
        return res;
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20