Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class P04building {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int floorCount = Integer.parseInt(scanner.nextLine());
- int roomsCountPerFloor = Integer.parseInt(scanner.nextLine());
- for(int floor = floorCount; floor > 0; floor--) {
- for (int room = 0; room < roomsCountPerFloor; room++) {
- if(floor == floorCount){
- System.out.printf("L%d%d ", floor, room);
- } else {
- if(floor %2 == 0){
- System.out.printf("O%d%d ", floor, room);
- } else{
- System.out.printf("A%d%d ", floor, room);
- }
- }
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment