-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBuilding
27 lines (25 loc) · 944 Bytes
/
Building
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package NestedLoops.Lab;
import java.util.Scanner;
public class building {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int floors = Integer.parseInt(input.nextLine());
int apartmentsPerFloor = Integer.parseInt(input.nextLine());
int floorCounter = floors;
for (int i = 0; i < floors; i++){
floorCounter --;
for (int j = 0; j < apartmentsPerFloor; j++) {
if (i == 0) {
System.out.printf("L%d%d ", floors - i, j);
} else {
if (floorCounter % 2 != 0) {
System.out.printf("O%d%d ", floors - i, j);
} else {
System.out.printf("A%d%d ", floors - i, j);
}
}
}
System.out.println();
}
}
}