Advertisement
Guest User

Untitled

a guest
Aug 30th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class TStripedTowel
  8. {
  9. static void Main()
  10. {
  11. int n = int.Parse(Console.ReadLine());
  12.  
  13. char stripe = '#';
  14. char space = '.';
  15.  
  16. for (int i = 1; i < n; i += 2)
  17. {
  18. int check = n;
  19. int checkTwo = n;
  20. int checkThree = n;
  21.  
  22. for (int j = 1; j <= n; )
  23. {
  24.  
  25. Console.Write(new string(stripe, 1));
  26. --check;
  27. ++j;
  28.  
  29. if (check >= 2)
  30. {
  31. Console.Write(new string(space, 2));
  32. check -= 2;
  33. j += 2;
  34. }
  35. else if (check == 1)
  36. {
  37. Console.Write(new string(space, 1));
  38. check -= 1;
  39. j += 1;
  40. }
  41. else
  42. {
  43. continue;
  44. }
  45. }
  46.  
  47. Console.WriteLine();
  48.  
  49. for (int m = 1; m <= n; )
  50. {
  51. if (checkTwo >= 2)
  52. {
  53. Console.Write(new string(space, 2));
  54. checkTwo -= 2;
  55. m += 2;
  56. }
  57. else if (checkTwo == 1)
  58. {
  59. Console.Write(new string(space, 1));
  60. checkTwo -= 1;
  61. m += 1;
  62. }
  63. if (checkTwo >= 1)
  64. {
  65. Console.Write(new string(stripe, 1));
  66. --checkTwo;
  67. ++m;
  68. }
  69.  
  70. }
  71.  
  72. Console.WriteLine();
  73.  
  74. for (int l = 1; l <= n; )
  75. {
  76. if (checkThree == n)
  77. {
  78. Console.Write(new string(space, 1));
  79. checkThree -= 1;
  80. l += 1;
  81. }
  82.  
  83. Console.Write(new string(stripe, 1));
  84. --checkThree;
  85. ++l;
  86.  
  87. if (checkThree >= 2)
  88. {
  89. Console.Write(new string(space, 2));
  90. checkThree -= 2;
  91. l += 2;
  92. }
  93. else if (checkThree == 1)
  94. {
  95. Console.Write(new string(space, 1));
  96. checkThree -= 1;
  97. l += 1;
  98. }
  99. else
  100. {
  101. continue;
  102. }
  103. }
  104. Console.WriteLine();
  105.  
  106. }
  107. int checkFour = n;
  108. for (int p = 1; p <= n; )
  109. {
  110. Console.Write(new string(stripe, 1));
  111. --checkFour;
  112. ++p;
  113.  
  114. if (checkFour >= 2)
  115. {
  116. Console.Write(new string(space, 2));
  117. checkFour -= 2;
  118. p += 2;
  119. }
  120. else if (checkFour == 1)
  121. {
  122. Console.Write(new string(space, 1));
  123. checkFour -= 1;
  124. p += 1;
  125. }
  126. else
  127. {
  128. continue;
  129. }
  130. }
  131. Console.WriteLine();
  132. }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement