Advertisement
fbinnzhivko

03.01 Ace of Diamonds

Mar 17th, 2016
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2. class AceOfDiamonds
  3. {
  4.     static void Main()
  5.     {
  6.         int size = int.Parse(Console.ReadLine());
  7.  
  8.         int topDash = ((size - 1) / 2) - 1;
  9.         int topSymbol = 1;
  10.         int bottomDash = 1;
  11.         int bottomSymbol = size - 4;
  12.        
  13.         Console.WriteLine("{0}", new string('*', size)); // First row
  14.         while (topDash >= 0)
  15.         {
  16.             Console.WriteLine("*{0}{1}{0}*", new string('-', topDash), new string('@', topSymbol));
  17.             topDash--;                    
  18.             topSymbol += 2;     // Top half + middle part
  19.         }
  20.  
  21.         while (bottomSymbol >= 1)
  22.         {
  23.             Console.WriteLine("*{0}{1}{0}*", new string('-', bottomDash), new string('@', bottomSymbol));
  24.             bottomDash ++;
  25.             bottomSymbol -= 2;
  26.         }
  27.         Console.WriteLine("{0}", new string('*', size)); // Last row
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement