Assignment #76 and Collatz Sequence

Code

   //Name: Mark Katz
    ///Period: 6
    ///Program Name: Collatz Sequence
    ///File Name: collatz.java
    ///Date Finished: 11/3/15
import java.util.Scanner;

public class collatz
{
	public static void main( String[] args )
	{
		Scanner keyboard = new Scanner(System.in);
        
        double n;
        
        System.out.print( "Starting number: ");
        n = keyboard.nextInt();
        
        while ( n!= 1)
        {
            if (n % 2 == 0)
            {
                n = n/2;
                System.out.print(n + "   ");
            }
            else 
            {
                n = 3*n + 1;
                System.out.print( n + "   " );
            }
        }
    }
}

    

Picture of the output

Assignment76