Advertisement
ad2bg

ChristmasSock

Dec 25th, 2017
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.74 KB | None | 0 0
  1. namespace ChristmasSock
  2. {
  3.     using System;
  4.  
  5.     static class ChristmasSock
  6.     {
  7.         static void Main()
  8.         {
  9.             string b = "|";
  10.             string d = "-";
  11.             string a = "*";
  12.             string t = "~";
  13.             string u = "_";
  14.             string p = ".";
  15.             string s = @"\";
  16.  
  17.  
  18.             int n = int.Parse(Console.ReadLine());
  19.  
  20.             Console.WriteLine(b + d.Times(2 * n) + b);
  21.             Console.WriteLine(b + a.Times(2 * n) + b);
  22.             Console.WriteLine(b + d.Times(2 * n) + b);
  23.  
  24.             int x = 2 * n - 3;
  25.             int m = (x + 1) / 2;
  26.  
  27.             for (int i = 1; i <= x; i++)
  28.             {
  29.                 int dd = Math.Abs(m - i) + 1;
  30.                 int tt = 2 * n - 2 * dd;
  31.                 Console.WriteLine(
  32.                     b +
  33.                     d.Times(dd) +
  34.                     t.Times(tt) +
  35.                     d.Times(dd) +
  36.                     b);
  37.             }
  38.  
  39.             x = n + 3;
  40.             m = (x + 1) / 2;
  41.             for (int i = 1; i <= x; i++)
  42.             {
  43.                 string line = (i == x ? u : p).Times(2 * n + 1);
  44.                 if (i == m - 1) { line = p.Times(n - 2) + "MERRY" + p.Times(n - 2); }
  45.                 if (i == m + 1) { line = p.Times(n - 2) + "X-MAS" + p.Times(n - 2); }
  46.  
  47.  
  48.                 Console.WriteLine(
  49.                     d.Times(i - 1) +
  50.                     s +
  51.                     line +
  52.                     (i == x ? ")" : s)
  53.                     );
  54.             }
  55.         }
  56.  
  57.         public static string Times(this string s, int x)
  58.         {
  59.             string newString = string.Empty;
  60.             for (int i = 0; i < x; i++) { newString += s; }
  61.             return newString;
  62.         }
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement