galinyotsev123

ProgBasics07Nested-Loops-P04building

Jan 7th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P04building {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int floorCount = Integer.parseInt(scanner.nextLine());
  8. int roomsCountPerFloor = Integer.parseInt(scanner.nextLine());
  9.  
  10. for(int floor = floorCount; floor > 0; floor--) {
  11. for (int room = 0; room < roomsCountPerFloor; room++) {
  12. if(floor == floorCount){
  13. System.out.printf("L%d%d ", floor, room);
  14. } else {
  15. if(floor %2 == 0){
  16. System.out.printf("O%d%d ", floor, room);
  17. } else{
  18. System.out.printf("A%d%d ", floor, room);
  19. }
  20. }
  21. }
  22. System.out.println();
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment