ackage com.javarush.task.jdk13.task06.task0632;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;
/*
Пирамида
*/
public class Solution {
public static char[][] array;
public static void main(String[] args) throws IOException {
//напишите тут ваш код
Scanner scanner = new Scanner(System.in);
int height = scanner.nextInt();
array = new char[height][height * 2 - 1];
int counter = 0;
int counterTwo = 0;
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
if (j == array[i].length) {
break;
} else if ((i == 0) && (j == array[i].length / 2)) {
array[i][j] = '#';
} else if ((i != 0) && ((j == array[i].length / 2) || (j == array[i].length / 2 - counter) || (j == array[i].length / 2 + counter))) {
array[i][j] = '#';
}
else if (((i!=0) && (i>=2)) && ((j == array[i].length / 2 - 1) || (j == array[i].length / 2 + 1))) {
array[i][j] = '#';
}
else if (((i!=0) && (i>=3)) && ((j == array[i].length / 2 - 2) || (j == array[i].length / 2 + 2))) {
array[i][j] = '#';
}
else if (((i!=0) && (i>=4)) && ((j == array[i].length / 2 - 3) || (j == array[i].length / 2 + 3))) {
array[i][j] = '#';
}
else{
array[i][j] = ' ';
}
System.out.print(array[i][j]);
}
if (i>=2){
counterTwo++;
}
counter++;
System.out.println();
}
}
}
package com.javarush.task.jdk13.task06.task0632;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;
/*
Пирамида
*/
public class Solution {
public static char[][] array;
public static void main(String[] args) throws IOException {
//напишите тут ваш код
Scanner scanner = new Scanner(System.in);
int height = scanner.nextInt();
array = new char[height][height * 2 - 1];
int counter = 0;
int counterTwo = 0;
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
if (j == array[i].length) {
break;
} else if ((i == 0) && (j == array[i].length / 2)) {
array[i][j] = '#';
} else if ((i != 0) && ((j == array[i].length / 2) || (j == array[i].length / 2 - counter) || (j == array[i].length / 2 + counter))) {
array[i][j] = '#';
}
else if (((i!=0) && (i>=2)) && ((j == array[i].length / 2 - 1) || (j == array[i].length / 2 + 1))) {
array[i][j] = '#';
}
else if (((i!=0) && (i>=3)) && ((j == array[i].length / 2 - 2) || (j == array[i].length / 2 + 2))) {
array[i][j] = '#';
}
else if (((i!=0) && (i>=4)) && ((j == array[i].length / 2 - 3) || (j == array[i].length / 2 + 3))) {
array[i][j] = '#';
}
else{
array[i][j] = ' ';
}
System.out.print(array[i][j]);
}
if (i>=2){
counterTwo++;
}
counter++;
System.out.println();
}
}
}