Assignment #112 and Odometer Loops
Code
///Name: Tim Gibson
///Period: 6
///Project Name: Odometer Loops
///File Name: OdometerLoops.java
///Date Finished: 12/9/15
import java.util.Scanner;
public class OdometerLoops
{
public static void main( String[] args ) throws Exception
{
Scanner kb = new Scanner(System.in);
int b;//b for base
System.out.print("Which base (2-10): " );
b = kb.nextInt();
for ( int thous=0; thous< b; thous++ )
for ( int hund = 0; hund< b; hund++ )
for ( int tens=0; tens< b; tens++ )
for ( int ones=0; ones< b; ones++ )
{
System.out.print( " " + thous + "" + hund + "" + tens + "" + ones + "\r" );
Thread.sleep(50);
}
System.out.println();
}
}
//it worked exactly the same after removing brackets
Picture of the output