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