Assignment #112 Odometer Loops
Code
/// Name: Koosha Kimelman
/// Period: 7
/// Program Name: Odometer Loops
/// File name: OdometerLoops
/// Date Completed: 4/15/16
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 n = k.nextInt();
for (int thous = 0; thous < n; thous++)
for (int hund = 0; hund < n; hund++)
for (int tens = 0; tens < n; tens++)
for (int ones = 0; ones < n; ones++) {
System.out.print(" " + thous + "" + hund + "" + tens + "" + ones + "\r");
if (n >= 7)
Thread.sleep(3);
else if (n <= 4)
Thread.sleep(75);
else
Thread.sleep(30);
}
System.out.println();
}
}
Picture of the output