Assignment 112; OdLoops
Code
// Donovan Rich
// Period 6
// Odometer Loops
// OdLoops
// 5/2/2016
import java.util.Scanner;
public class OdLoops
{
public static void main( String[] args ) throws Exception
{
Scanner keyboard = new Scanner(System.in);
System.out.print("Base: ");
int b = keyboard.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(10);
}
// It still functions without braces.
System.out.println();
}
}
Picture of the output