Prog 76: Collatz Sequence

///Name: Ilana Levy
///Period: 5
///Program Name: Collatz Sequence
///File Name: collatzSequence.java
///Date Finished: 9/24/2015

import java.util.Scanner;

public class collatzSequence
{
        public static void main( String[] args )
        {
                Scanner keyboard = new Scanner( System.in );
                int number, steps = 1;
                
                System.out.print( "Starting number: " );
                number = keyboard.nextInt();
                
                int total = number;
            
                do
                {
                    
                    if ( total % 2 == 0 ) // if even
                    {
                        total = total/ 2 ;    
                        System.out.println( steps + ". " + total);
                    }
                    else
                    {
                        total = total * 3 + 1 ;
                        System.out.println( steps + ". " + total);
                    }
                
                    steps++;
                }   while (total > 1 );
                
                
        }
}