Advertisement
fbinnzhivko

03.King of Thieves

Mar 19th, 2016
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.47 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         var number = int.Parse(Console.ReadLine());
  8.         var gem = Console.ReadLine()[0];
  9.  
  10.  
  11.         Console.Write(new string('-', (number - 1) / 2));
  12.         Console.Write(gem);
  13.         Console.WriteLine(new string('-', (number - 1) / 2));
  14.  
  15.  
  16.         int rows = (number - 1) / 2;
  17.         for (int curentRow = 0; curentRow < rows; curentRow++)
  18.         {
  19.             var numberOfDashes = curentRow * 2 + 1;
  20.             var numberOfDashesOutside = number - 2 - numberOfDashes;
  21.             Console.Write(new string('-', numberOfDashesOutside / 2));
  22.             Console.Write(gem);
  23.             Console.Write(new string(gem, numberOfDashes));
  24.             Console.Write(gem);
  25.             Console.WriteLine(new string('-', numberOfDashesOutside / 2));
  26.  
  27.         }
  28.         for (int curentRow = rows - 2; curentRow >= 0; curentRow--)
  29.         {
  30.             var numberOfDashes = (curentRow * 2) + 1;
  31.             var numberOfDashesOutside = number - 2 - numberOfDashes;
  32.             Console.Write(new string('-', numberOfDashesOutside / 2));
  33.             Console.Write(gem);
  34.             Console.Write(new string(gem, numberOfDashes));
  35.             Console.Write(gem);
  36.             Console.WriteLine(new string('-', numberOfDashesOutside / 2));
  37.         }
  38.         Console.Write(new string('-', (number - 1) / 2));
  39.         Console.Write(gem);
  40.         Console.WriteLine(new string('-', (number - 1) / 2));
  41.     }
  42.    
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement