Assignemnt #76 and Collatz Sequence Code /// Name: Yordan Rashkov /// Period: 7 /// Program Name: Collatz Sequence /// File Name: CollatzSequence.java /// Date Finished: 2/3/2016 import java.util.Scanner; public class CollatzSequence { public static void main( String[] args ) { Scanner keyboard = new Scanner(System.in); int num; System.out.println( "Starting number: " ); num = keyboard.nextInt(); while ( num <= 0 ) { System.out.println( "The number that you entered must be greater than 0! Please try again! " ); num = keyboard.nextInt(); } while ( num != 1 ) { if ( num % 2 == 0 ) { num = num / 2; System.out.println( num); } else if ( num % 2 != 0 ) { num = (num * 3) + 1; System.out.println( num); } } } }