BapBapuHa

building

Feb 22nd, 2020
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.         int numberOfFloors = Integer.parseInt(scanner.nextLine());
  10.         int roomsPerFloor = Integer.parseInt(scanner.nextLine());
  11.         for (int i = numberOfFloors; i > 0; i--) {
  12.             int counter = 0;
  13.             for (int n = roomsPerFloor; n > 0; n--) {
  14.                     if (i == numberOfFloors) {
  15.                         System.out.printf("L%d%d ", i, counter);
  16.                         counter++;
  17.                 } else if (i % 2 == 0) {
  18.                         System.out.printf("O%d%d ", i, counter);
  19.                         counter++;
  20.                     } else {
  21.                         System.out.printf("A%d%d ", i, counter);
  22.                         counter++;
  23.                     }
  24.                 }
  25.             System.out.printf("%n");
  26.             }
  27.         }
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment