Assignemnt #112

Code



     /// Name: Daniel Nguyen
    /// Period: 6
    /// Project Name: OdometerLoops
    /// File Name: OdometerLoops.java
    /// Date: 3/11/2015

import java.util.Scanner;
import java.util.InputMismatchException;

public class OdometerLoops
{
	public static void main( String[] args ) throws Exception
	{
		Scanner keyboard = new Scanner(System.in);
		int base = 0;

		try
		{
			System.out.print("Choose the base: ");
			base = keyboard.nextInt();
			System.out.println("");
		}
		catch (InputMismatchException e)
		{
			System.out.println("WRONG INPUT");
		}

		for ( int thous=0; thous < base; thous++ )
			for ( int hund=0; hund < base; hund++ )
				for ( int tens=0; tens < base; tens++ )
					for ( int ones=0; ones < base; ones++ )
					{
						System.out.print( " " + thous + "" + hund + "" + tens + "" + ones + "\r" );
						Thread.sleep(10);
					}

		System.out.println();
	}
}








    

Picture of the output

Assignment 3
BACK HOME NEXT