Advertisement
viraco4a

Sock

Mar 7th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 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. namespace ChristmasSock
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. PrintTop(n);
  15.  
  16. for (int i = 1; i <= n - 1; i++)
  17. {
  18. PrintMiddle(n, i);
  19. }
  20.  
  21. for (int i = n - 2; i > 0; i--)
  22. {
  23. PrintMiddle(n, i);
  24. }
  25.  
  26. for (int i = 1; i <= n + 2; i++)
  27. {
  28. if (i <= n / 2 || i > (n / 2) + 3)
  29. {
  30. string bottomDash = new string('-', i - 1);
  31. string bottomDots = new string('.', 2 * n + 1);
  32. Console.WriteLine($"{bottomDash}\\{bottomDots}\\");
  33. }
  34. else
  35. {
  36. string bottomDash = new string('-', i - 1);
  37. if (i == n / 2 + 1)
  38. {
  39. string strangeDots = new string('.', n - 2);
  40. Console.WriteLine($"{bottomDash}\\{strangeDots}MERRY{strangeDots}\\");
  41. }
  42. else if (i == n / 2 + 2)
  43. {
  44. string strangeDots = new string('.', 2 * n + 1);
  45. Console.WriteLine($"{bottomDash}\\{strangeDots}\\");
  46. }
  47. else
  48. {
  49. string strangeDots = new string('.', n - 2);
  50. Console.WriteLine($"{bottomDash}\\{strangeDots}X-MAS{strangeDots}\\");
  51. }
  52. }
  53. }
  54. PrintLast(n);
  55. }
  56.  
  57. private static void PrintLast(int n)
  58. {
  59. string lastDash = new string('-', n + 2);
  60. string lastLines = new string('_', 2 * n + 1);
  61. Console.WriteLine($"{lastDash}\\{lastLines})");
  62. }
  63.  
  64. private static void PrintTop(int n)
  65. {
  66. string UpperDashes = new string('-', n * 2);
  67. string UpperStars = new string('*', n * 2);
  68. Console.WriteLine($"|{UpperDashes}|");
  69. Console.WriteLine($"|{UpperStars}|");
  70. Console.WriteLine($"|{UpperDashes}|");
  71. }
  72.  
  73. private static void PrintMiddle(int n, int i)
  74. {
  75. string middleDash = new string('-', n - i);
  76. string waves = new string('~', i * 2);
  77. Console.WriteLine($"|{middleDash}{waves}{middleDash}|");
  78. }
  79. }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement