-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuilding.java
More file actions
27 lines (21 loc) · 714 Bytes
/
Copy pathBuilding.java
File metadata and controls
27 lines (21 loc) · 714 Bytes
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;
import java.util.Scanner;
public class Building {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int floors = Integer.parseInt(scanner.nextLine());
int rooms = Integer.parseInt(scanner.nextLine());
for (int i = floors; i > 0 ; i--) {
for (int j = 0; j < rooms ; j++) {
if(i == floors){
System.out.printf("L%d%d ",i,j);
}else if(i % 2 == 0){
System.out.printf("O%d%d ",i,j);
}else {
System.out.printf("A%d%d ",i,j);
}
}
System.out.println();
}
}
}