Advertisement
another90sm

WineGlass

Jan 15th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.26 KB | None | 0 0
  1. using System;
  2.  
  3. class WineGlass
  4. {
  5.     static void Main()
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.         char backSlash = '\\';
  9.         char star = '*';
  10.         char slash = '/';
  11.         char verticalLine = '|';
  12.         char dot = '.';
  13.         char dash = '-';
  14.  
  15.         //top
  16.         for (int i = 0, j = 0; i < n / 2; i++, j += 2)
  17.         {
  18.             Console.WriteLine("{0}{1}{2}{3}{0}", new string(dot, i), backSlash, new string(star, n - 2 - j), slash);
  19.         }
  20.  
  21.         //middle and bottom
  22.         if (n >= 12)
  23.         {
  24.  
  25.             for (int i = 0; i < n / 2 - 2; i++)
  26.             {
  27.                 Console.WriteLine("{0}{1}{0}", new string(dot, n / 2 - 1), new string(verticalLine, 2));
  28.             }
  29.  
  30.             for (int i = 0; i < n - (n - 2); i++)
  31.             {
  32.                 Console.WriteLine("{0}", new string(dash, n));
  33.             }
  34.         }
  35.         else
  36.         {
  37.             for (int i = 0; i < n / 2 - 1; i++)
  38.             {
  39.                 Console.WriteLine("{0}{1}{0}", new string(dot, n / 2 - 1), new string(verticalLine, 2));
  40.             }
  41.  
  42.             for (int i = 0; i < n - (n - 1); i++)
  43.             {
  44.                 Console.WriteLine("{0}", new string(dash, n));
  45.             }
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement