Assignment #112 Odometer Loops
Code
Name: Iaroslav Titov
Period: 7
Project Name: OdometerLoops
File Name: OdometerLoops.java
Date: 1/12/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