Advertisement
miroLLL

AceOfDiamonds

Nov 28th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 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.  
  8. class AceOfDiamonds
  9. {
  10.     static void Main()
  11.     {
  12.         int size = int.Parse(Console.ReadLine());
  13.  
  14.         int topDash = ((size - 1) / 2) - 1;
  15.         int topSymbol = 1;
  16.  
  17.         int bottomDash = 1;
  18.         int bottomSymbol = size - 4;
  19.  
  20.         string firstAndLastRow = new string('*', size); // First row
  21.  
  22.         Console.WriteLine(firstAndLastRow);
  23.  
  24.         while (topDash >= 0)
  25.         {
  26.             string insideUpRows = "*" + new string('-', topDash) + new string('@', topSymbol) + new string('-', topDash) + "*"; // Top half + middle part
  27.             Console.WriteLine(insideUpRows);
  28.             topDash--;
  29.             topSymbol += 2;
  30.         }
  31.  
  32.         while (bottomSymbol >= 1)
  33.         {
  34.             string insideDownRows = "*" + new string('-', bottomDash) + new string('@', bottomSymbol) + new string('-', bottomDash) + "*"; // Bottom half
  35.             Console.WriteLine(insideDownRows);
  36.             bottomDash++;
  37.             bottomSymbol -= 2;
  38.         }
  39.          
  40.         Console.WriteLine(firstAndLastRow); // Last row
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement