Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- printFormation2(8);
- }
- private static void printFormation2(int number) {
- number = number * 2 + 1;
- for (int row = 1; row < number; row++) {
- for (int column = 1; column <= number; column++) {
- if ((row == column || column == number - row + 1) && row < number / 2 + 1) {
- System.out.print(column <= number / 2 ? "\\" : "/");
- } else if (column == number / 2 + 1) {
- System.out.print("|");
- } else {
- System.out.print(".");
- }
- }
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement