Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine()),
- x = n > 4 ? n * 2 - (n / 2 + 2) * 2 : 0;
- System.out.printf("/%s\\%s/%s\\\n", "^".repeat(n / 2), "_".repeat(x), "^".repeat(n / 2));
- for (int i = 0; i < n - 3; i++) {
- System.out.printf("|%s|\n", " ".repeat(n * 2 - 2));
- }
- System.out.printf("|%s%s%s|\n", " ".repeat((n * 2 - (x + 2)) / 2), "_".repeat(x), " ".repeat((n * 2 - (x + 2)) / 2));
- System.out.printf("\\%s/%s\\%s/\n", "_".repeat(n / 2), " ".repeat(x), "_".repeat(n / 2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement