1 /*Problem Description
 2 对于一个数n,如果是偶数,就把n砍掉一半;如果是奇数,把n变成 3*n+ 1后砍掉一半,直到该数变为1为止。
 3 请计算需要经过几步才能将n变到1,具体可见样例。 
 4 Input
 5 测试包含多个用例,每个用例包含一个整数n,当n为0 时表示输入结束。(1<=n<=10000) 
 6 Output
 7 对于每组测试用例请输出一个数,表示需要经过的步数,每组输出占一行。 
 8 Sample Input
 9 3
10 1
11 0
12 
13 Sample Output
14 5
15 0
16 */
17 #include<stdio.h>
18 int main()
19 {
20     int n , step ;
21     while(scanf("%d",&n) != EOF && n)
22     {
23         step = 0;
24         while(n != 1)
25         {
26              if(n % 2 == 0)
27              n /= 2;
28              else{
29              n = 3 * n + 1 ;
30              n /= 2;}
31              step = step + 1;
32         }
33         printf("%d\n",step);
34     }
35     return 0;
36 }