aneliabogeva

Building

Nov 26th, 2020
427
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Building {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         Integer floors = Integer.parseInt(scanner.nextLine());
  7.         Integer rooms = Integer.parseInt(scanner.nextLine());
  8.  
  9.  
  10.         for(int i = floors; i >= 1; i--){
  11.             if(floors == 1 || i == floors){
  12.                 Integer decRooms = rooms;
  13.                 for(decRooms = 0; decRooms < rooms; decRooms++){
  14.                     System.out.printf("L%d%d ",i,decRooms);
  15.                 }
  16.                 System.out.println();
  17.             }else if(i % 2 == 0){
  18.                 Integer decRooms = rooms;
  19.                 for(decRooms = 0; decRooms < rooms; decRooms++){
  20.                     System.out.printf("O%d%d ",i,decRooms);
  21.                 }
  22.                 System.out.println();
  23.             }else {
  24.                 Integer decRooms = rooms;
  25.                 for(decRooms = 0; decRooms < rooms; decRooms++){
  26.                     System.out.printf("A%d%d ",i,decRooms);
  27.                 }
  28.                 System.out.println();
  29.             }
  30.         }
  31.     }
  32. }
  33.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×