Professional Documents
Culture Documents
CDC1
CDC1
WAP to print the maximum number generated by the collatz sequence from the start
number given as input.
Explanation
6 3 10 5 16 8 4 2 1
If n is even, n becomes n/2
If n is odd,n becomes (n*3)+1
1 is the terminating number.
Create two classes called Main and UserMainCode in the same source file named
your_id.java.
Add a static method findMax with integer return type.
Sample Input
6
Sample Output
16