Boyan5

Untitled

Nov 9th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class зада {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6. int n = scan.nextInt();
  7. int i = 0;
  8. //first row
  9. while (i < n + 1) {
  10. System.out.print(".");
  11. i++;
  12. }
  13.  
  14. i = 0;
  15. while (i < n * 2 + 1) {
  16. System.out.print("_");
  17. i++;
  18. }
  19. i = 0;
  20. while (i < n + 1) {
  21. System.out.print(".");
  22. i++;
  23. }
  24. System.out.println();
  25. // second row
  26. int dots = n;
  27. int underscore = n * 2 - 1;
  28. int rows = 0;
  29.  
  30. while (rows < n) {
  31. i = 0;
  32. while (i < dots) {
  33. System.out.print(".");
  34. i++;
  35. }
  36. System.out.print("//");
  37. i = 0;
  38. while (i < underscore) {
  39. System.out.print("_");
  40. i++;
  41. }
  42. System.out.print("\\\\");
  43. i = 0;
  44. while (i < dots) {
  45. System.out.print(".");
  46. i++;
  47. }
  48. System.out.println();
  49. dots--;
  50. underscore += 2;
  51. rows++;
  52. }
  53. // STOP!
  54. System.out.print("//");
  55. i = 0;
  56. while (i < (underscore - 5) / 2) {
  57. System.out.print("_");
  58. i++;
  59. }
  60. System.out.print("STOP!");
  61. i = 0;
  62. while (i < (underscore - 5) / 2) {
  63. System.out.print("_");
  64. i++;
  65. }
  66. System.out.println("\\\\");
  67. //last row
  68. dots = 0;
  69. rows = 0;
  70. int underscore1 = n * 4 - 1;
  71. while (rows < n) {
  72. i = 0;
  73. while (i < dots) {
  74. System.out.print(".");
  75. i++;
  76. }
  77. System.out.print("\\\\");
  78. i = 0;
  79. while (i < underscore1) {
  80. System.out.print("_");
  81. i++;
  82. }
  83. System.out.print("//");
  84. i = 0;
  85. while (i < dots) {
  86. System.out.print(".");
  87. i++;
  88. }
  89. System.out.println();
  90. dots++;
  91. underscore1-=2;
  92. rows++;
  93. }
  94. }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment