Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. public static void main(String[] args) {
  2.  
  3. String star = "*";
  4. String cross = "+";
  5. System.out.println();
  6. System.out.println();
  7.  
  8. // CHOINKA PODSTAWOWA
  9.  
  10. // glowna czesc choinki
  11.  
  12. for (int i = 0; i < 10; i++) {
  13. for (int j = 0; j < 20; j++) {
  14. if (j <= 10 + i && j >= 10 - i) {
  15. System.out.print(star);
  16. } else {
  17. System.out.print(" ");
  18. }
  19. }
  20. System.out.println();
  21. }
  22.  
  23. // pień choinki
  24.  
  25. for (int i = 0; i < 4; i++) {
  26. for (int j = 0; j < 19; j++) {
  27. if (j >= 8 && j <= 12) {
  28. System.out.print(star);
  29. } else {
  30. System.out.print(" ");
  31. }
  32. }
  33. System.out.println();
  34. }
  35. System.out.println();
  36. System.out.println();
  37. // ----------------------------------------------------------------->
  38. // CHOINKA ROZSZERZONA
  39.  
  40. // glowna czesc choinki
  41. for (int i = 0; i < 8; i++) {
  42.  
  43. for (int j = 0; j < 19; j++) {
  44. if (j >= 10 - i && j <= 10 + i) {
  45. if (j < 10 + i && j > 10 - i) {
  46. System.out.print(cross);
  47. } else {
  48. System.out.print(star);
  49. }
  50. } else {
  51. System.out.print(" ");
  52. }
  53. }
  54.  
  55. System.out.println();
  56.  
  57. }
  58. // podstawa choinki
  59. for (int y = 0; y < 19; y++) {
  60. if (y > 1) {
  61. System.out.print(star);
  62. } else {
  63. System.out.print(" ");
  64. }
  65. }
  66. // pień
  67. System.out.println();
  68. for (int i = 0; i < 3; i++) {
  69. for (int j = 0; j < 19; j++) {
  70. if (j >= 8 && j <= 12) {
  71. System.out.print(star);
  72. } else {
  73. System.out.print(" ");
  74. }
  75. }
  76.  
  77. System.out.println();
  78. }
  79.  
  80. //----------------------------------------------------->
  81. // pusta choinka
  82.  
  83.  
  84. System.out.println();
  85. System.out.println();
  86. // glowna czesc choinki
  87. for (int i = 0; i < 8; i++) {
  88.  
  89. for (int j = 0; j < 19; j++) {
  90. if (j >= 10 - i && j <= 10 + i) {
  91. if (j < 10 + i && j > 10 - i) {
  92. System.out.print(" ");
  93. } else {
  94. System.out.print(star);
  95. }
  96. } else {
  97. System.out.print(" ");
  98. }
  99. }
  100.  
  101. System.out.println();
  102.  
  103. }
  104. // podstawa choinki
  105. for (int y = 0; y < 19; y++) {
  106. if (y > 1) {
  107. System.out.print(star);
  108. } else {
  109. System.out.print(" ");
  110. }
  111. }
  112. // pień
  113. System.out.println();
  114. for (int i = 0; i < 3; i++) {
  115. for (int j = 0; j < 19; j++) {
  116. if (j >= 8 && j <= 12) {
  117. System.out.print(star);
  118. } else {
  119. System.out.print(" ");
  120. }
  121. }
  122.  
  123. System.out.println();
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement