Advertisement
Guest User

Untitled

a guest
May 6th, 2017
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. package DrawingWithLoops;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6. * Created by Minito on 20.4.2017 г..
  7. */
  8. public class Demo_Fox {
  9. public static void main(String[] args) {
  10. Scanner console = new Scanner(System.in);
  11. int n = Integer.parseInt(console.nextLine());
  12. int dashCount = (n * 2) -1;
  13.  
  14. for (int i = 0; i < n ; i++) {
  15. String star = newString("*", i + 1);
  16. String dash = newString("-",dashCount - 2 * i);
  17. System.out.println(star + "\\" + dash +"/"+star);
  18. }
  19.  
  20. for (int i = 0; i < n / 3 ; i++) {
  21. String stars = newString("*", n / 2 + i);
  22. String starsIn = newString("*",n - 2 * i);
  23. System.out.println("|" + stars + "\\" +starsIn + "/" + stars + "|");
  24.  
  25. }
  26.  
  27. for (int i = 0; i < n ; i++) {
  28. String star = newString("*", dashCount - 2 * i);
  29. String dash = newString("-",i + 1);
  30. System.out.println(dash + "\\" + star +"/"+dash);
  31. }
  32.  
  33.  
  34. }public static String newString(String text, int repeatCount) {
  35. String a = "";
  36. for (int i = 0; i < repeatCount; i++) {
  37. a += text;
  38. }
  39. return a;
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement