Assignment #112
Code
/// Name:Mahima Choudhary
/// Period: 6
/// Program Name: Odometer Loops
/// File Name: OdometerLoops.java
/// Date Finished: 2/8/2016
import java.util.Scanner;
public class OdometerLoops
{
public static void main( String[] args ) throws Exception
{
Scanner k = new Scanner(System.in);
System.out.print("Which base (2-10): ");
int base = k.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(500);
}
System.out.println();
}
} //stills works without outer braces
Picture of the output