Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class Main {
- public static String makeSymbols(String str, int num) {
- String symbol = "";
- int i = 0;
- while ( i < num) {
- symbol += str;
- i++;
- }
- return symbol;
- }
- public static void arrow(int n) {
- //top line
- System.out.print(makeSymbols(".", n / 2));
- System.out.print(makeSymbols("#", n));
- System.out.println(makeSymbols(".", n / 2));
- // top
- int i = 1;
- while (i <= n - 2) {
- System.out.print(makeSymbols(".", n / 2) + "#");
- System.out.print(makeSymbols(".", n - 2));
- System.out.println("#" + makeSymbols(".", n / 2));
- i++;
- }
- // middle
- System.out.print("#" + makeSymbols("#", n / 2));
- System.out.print(makeSymbols(".", n - 2));
- System.out.println("#" + makeSymbols("#", n / 2));
- // bot
- int dots = 1;
- while (dots < n - 1) {
- System.out.print(makeSymbols(".", dots) + "#");
- System.out.print(makeSymbols(".", (n * 2 - 1) - dots * 2 - 2) + "#");
- System.out.println(makeSymbols(".",dots));
- dots++;
- }
- System.out.println(makeSymbols(".",dots) + "#" + makeSymbols(".",dots));
- }
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int n = scan.nextInt();
- arrow(n);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement