Assignemnt #112: Odometer Loops
Code
/// Name: Kelsey Lieberman
/// Period 5
/// Program Name: OdometerLoops
/// File Name: OdometerLoops.java
/// Date Finished: 2/9/2016
import java.util.Scanner;
public class OdometerLoops
{
public static void main( String[] args ) throws Exception
{
Scanner key = new Scanner(System.in);
int base;
System.out.print("Which base? (2-10): ");
base = key.nextInt();
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();
}
}
/// yes, it still works
Picture of the output