Hailstone Numbers
Source Code
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = 0, num = in.nextInt();
do{
if(num != 1){
a++;
if(num % 2 == 0){
num /= 2;
}else{
num = num * 3 + 1;
}
}
}while(num != 1);
System.out.println(a);
}
}