Dugaan collatz
import java.util.Scanner;
public class CollatzConjecture {
public static void main(String[] args){
System.out.println("Enter a positive number");
Scanner userInput = new Scanner(System.in);
int n = userInput.nextInt();
while (n!=1) {
if (n % 2 == 0) {
n = n / 2;
} else if (n % 2 == 1) {
n =3 * n + 1;
}
}
System.out.println(n);
}
}
Breakable Boar