Advertisement
didatzi

AXE

Mar 2nd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4.  * Created by Didatsy on 1.3.2017 г..
  5.  */
  6. public class main {
  7.     private static String repeat(String strToRepeat, int count) {
  8.         String text = "";
  9.         for (int i = 0; i < count; i++) {
  10.             text = text + strToRepeat;
  11.         }
  12.         return text;
  13.     }
  14.  
  15.     public static void main(String[] args) {
  16.         Scanner scanner = new Scanner(System.in);
  17.         int n = Integer.parseInt(scanner.nextLine());
  18.  
  19.         for (int i = 0; i <n ; i++) {
  20.             System.out.println(repeat("-",3* n)+ "*" + repeat("-", i)+"*" + repeat("-", 2*n-2-i));
  21.         }
  22.         for (int i = 0; i < n/2; i++) {
  23.             System.out.println(repeat("*",3*n)+ "*"+ repeat("-",n-1)+ "*" + repeat("-", n-1));
  24.         }
  25.         for (int i = 0; i < n/2; i++) {
  26.             if (i == n/2-1){
  27.                 System.out.println(repeat("-",3*n-i)+"*"+repeat("*",(n-1)+(i*2))+"*"+ repeat("-",n-1-i));
  28.             }else {
  29.                 System.out.println(repeat("-", 3 * n - i) + "*" + repeat("-", (n - 1) + (i * 2)) + "*" + repeat("-", n - 1 - i));
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement