Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Sky {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int n = Integer.parseInt(scanner.nextLine());
  8.  
  9. for (int i = 0; i < n-2 ; i++) {
  10.  
  11.  
  12.  
  13. if (i == n - 2 - 1) {
  14.  
  15. System.out.println(draw(" ", n - 1) + "_|_" + draw(" ", n - 1));
  16.  
  17. break;
  18.  
  19. }
  20. System.out.println(draw(" ", n) + "|" + draw(" ", n));
  21.  
  22. }
  23.  
  24.  
  25.  
  26. }
  27.  
  28.  
  29.  
  30.  
  31.  
  32. public static String draw(String str,int count) {
  33. StringBuilder output = new StringBuilder();
  34.  
  35. for (int i = 0; i < count; i++) {
  36. output.append(str);
  37.  
  38. }
  39.  
  40. return output.toString();
  41.  
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement