Advertisement
Guest User

Untitled

a guest
Aug 31st, 2017
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Butterfly {
  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 row = 0; row < n - 2; row++) {
  10. System.out.print(repeatStr("*", n - 2));
  11. System.out.print("\\");
  12. System.out.print(" ");
  13. System.out.print("/");
  14. System.out.println(repeatStr("*", n - 2));
  15.  
  16. System.out.print(repeatStr("-", n - 2));
  17. System.out.print("\\");
  18. System.out.print(" ");
  19. System.out.print("/");
  20. System.out.println(repeatStr("-", n - 2));
  21. }
  22.  
  23. System.out.print(repeatStr(" ", n-1));
  24. System.out.println("@");
  25.  
  26. for (int row = 0; row < n - 2; row++){
  27. System.out.print(repeatStr("*", n - 2));
  28. System.out.print("/");
  29. System.out.print(" ");
  30. System.out.print("\\");
  31. System.out.println(repeatStr("*", n -2));
  32.  
  33. System.out.print(repeatStr("-", n - 2));
  34. System.out.print("/");
  35. System.out.print(" ");
  36. System.out.print("\\");
  37. System.out.println(repeatStr("-", n - 2));
  38. }
  39. }
  40. static String repeatStr(String strToRepeat, int count) {
  41. String text = "";
  42.  
  43. for (int i = 0; i < count; i++) {
  44. text = text + strToRepeat;
  45. }
  46.  
  47. return text;
  48. }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement