Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class demo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- String firstline = repeatStr("#", n * 4 + 1);
- System.out.println(firstline);
- for (int i = 0; i < n; i++) {
- String line = repeatStr(".", 1 + i)
- + repeatStr("#", (2 * n - 1) - i * 2)
- + repeatStr(" ", 1 + i * 2)
- + repeatStr("#", (2 * n - 1) - i * 2)
- + repeatStr(".", 1 + i);
- if(i == n / 2){
- line = repeatStr(".", 1 + i)
- + repeatStr("#", (2 * n - 1) - i * 2)
- + repeatStr(" ", (1 + i * 2) / 2 - 1)
- + "(@)"
- + repeatStr(" ", (1 + i * 2) / 2 - 1)
- + repeatStr("#", (2 * n - 1) - i * 2)
- + repeatStr(".", 1 + i);
- }
- System.out.println(line);
- }
- for (int i = 0; i < n; i++) {
- String lastPart = repeatStr(".", n + 1 + i)
- + repeatStr("#", n * 2 - 1 - 2 * i)
- + repeatStr(".", n + 1 + i);
- System.out.println(lastPart);
- }
- } public static String repeatStr(String strToRepeat, int count) {
- String text = "";
- for (int i = 0; i < count; i++) {
- text += strToRepeat;
- }
- return text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement