Assignment #112
Code
/*
jack newsom
period 5
program OdometerLoops
filename OdometerLoops.java
date completed 11/12/2015
*/
//when the braces are removed the program still works
import java.util.Scanner;
public class OdometerLoops
{
public static void main( String[] args ) throws Exception
{
Scanner bot = new Scanner(System.in);
System.out.println("Choose a base (2-10): ");
int base = bot.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();
}
}
Picture of the output