Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class t04 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int floors = Integer.parseInt(scanner.nextLine());
- int rooms = Integer.parseInt(scanner.nextLine());
- //1. преминем през всички етажи от последния към първия
- for (int floor = floors; floor >= 1; floor--) {
- //за всеки един етаж
- //минем през всички стаи
- for (int room = 0; room < rooms; room++) {
- //последен
- if (floor == floors) {
- System.out.printf("L%d%d ", floor, room);
- } else if (floor % 2 == 0) {
- System.out.printf("O%d%d ", floor, room);
- } else if (floor % 2 == 1) {
- System.out.printf("A%d%d ", floor, room);
- }
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement