Assignment # 112 and Odometer
Code
/// Name: Tommy Oyuntseren
/// Period: 7
/// Program Name: Odometer
/// File Name: Odometer.java
/// Date: 5/5/16
///the program still works without the braces on the outer for-loops
import java.util.Scanner;
public class Odometer
{
public static void main(String[] args) throws Exception
{
Scanner keyboard= new Scanner(System.in);
System.out.print("Pick a base (2-10): ");
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(500);
}
System.out.println();
}
}
Picture of the output