Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class zadacha5 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- int shir = 3 * n + 6;
- int vis = 3 * n + 1;
- int counter1 = 0;
- int counter2 = 0;
- for (int i = 0; i < n; i++) {
- System.out.print(repeatStr(" ", n));
- System.out.println("~ ~ ~");
- }
- System.out.println(repeatStr("=", 3 * n + 5));
- for (int j = 1; j <= n - 2; j++) {
- String line = "|" + repeatStr("~", 2 * n + 4) + "|" + repeatStr(" ", n - 1) + "|";
- if (j == n / 2) {
- line = "|" + repeatStr("~", n) + "JAVA" + repeatStr("~", n) + "|" + repeatStr(" ", n - 1) + "|";
- }
- System.out.println(line);
- }
- System.out.println(repeatStr("=", 3 * n + 5));
- for (int m = 0; m < n; m++) {
- System.out.print(repeatStr(" ", counter1));
- System.out.print("\\");
- System.out.print(repeatStr("@", 2 * n + 4 + counter2));
- System.out.println("/");
- counter1++;
- counter2 -= 2;
- }
- System.out.println(repeatStr("=", 2 * n + 6));
- }
- static String repeatStr(String str, int count) {
- String text = "";
- {
- for (int j = 0; j < count; j++) {
- text = text + str;
- }
- }
- return text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement