Advertisement
KlimentHristov

Figure.WineGlass

Nov 30th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.79 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.        
  9.  
  10.         // last line
  11.         if (n < 12 )
  12.         {
  13.             // first line
  14.             Console.WriteLine("\\{0}/", new string('*', n - 2));
  15.             // end first line
  16.  
  17.             // second line
  18.             int outDots = 1;
  19.             int innerStars = n - 4;
  20.             for (int i = 0; i < n / 2 - 1; i++)
  21.             {
  22.                 Console.WriteLine("{0}\\{1}/{0}", new string('.', outDots), new string('*', innerStars));
  23.                 innerStars = innerStars - 2;
  24.                 outDots++;
  25.             }
  26.             // end second line
  27.  
  28.             // third line
  29.             for (int i = 0; i < n / 2 - 1; i++)
  30.             {
  31.                 Console.WriteLine("{0}||{0}", new string('.', n / 2 - 1));
  32.             }
  33.             // end third line
  34.             Console.WriteLine("{0}",new string ('-',n));
  35.         }
  36.         else if( n>=12)
  37.         {
  38.             // first line
  39.             Console.WriteLine("\\{0}/", new string('*', n - 2));
  40.             // end first line
  41.  
  42.             // second line
  43.             int outDots = 1;
  44.             int innerStars = n - 4;
  45.             for (int i = 0; i < n / 2 - 1; i++)
  46.             {
  47.                 Console.WriteLine("{0}\\{1}/{0}", new string('.', outDots), new string('*', innerStars));
  48.                 innerStars = innerStars - 2;
  49.                 outDots++;
  50.             }
  51.             // end second line
  52.  
  53.             // third line
  54.             for (int i = 0; i < n / 2 - 2; i++)
  55.             {
  56.                 Console.WriteLine("{0}||{0}", new string('.', n / 2 - 1));
  57.             }
  58.             // end third line
  59.             Console.WriteLine("{0}\n{0}", new string('-', n));
  60.         }
  61.        
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement