Assignment #111 Nesting Loops
Code
/// Name: Koosha Kimelman
/// Period: 7
/// Program Name: Nesting Loops
/// File Name: NestingLoops.java
/// Date Completed: 4/15/16
public class NestingLoops {
public static void main(String[] args) {
for (int n = 1; n <= 3; n++) {
for (char c = 'A'; c <= 'E'; c++) {
System.out.println(c + " " + n); // Variable n changes faster because it repeats the loop completely
} // every time c loops back to go again. When switched, it's backwards.
}
System.out.println("\n");
for (int a = 1; a <= 3; a++) {
for (int b = 1; b <= 3; b++) {
System.out.print(a + "-" + b + " "); // Changing this to println makes it look more like the first set.
}
System.out.println(); // This will make it look more like a 3x3 square with the sets of numbers.
}
System.out.println();
}
}
Picture of the output