Advertisement
simonradev

Castle

Feb 25th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.68 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. namespace EqualPairs
  8. {
  9.     class EqualPairs
  10.     {
  11.         static void Main()
  12.         {
  13.             int size = int.Parse(Console.ReadLine());
  14.  
  15.             int arrowUp = size / 2;
  16.             int botDash = (size - (size / 2 + 2)) * 2;
  17.  
  18.             //printing the roof
  19.             string roofOfCastle = "/" +
  20.                                   new string('^', arrowUp) +
  21.                                   "\\" +
  22.                                   new string('_', botDash) +
  23.                                   "/" +
  24.                                   new string('^', arrowUp) +
  25.                                   "\\";
  26.             Console.WriteLine(roofOfCastle);
  27.  
  28.             //printing the middle part
  29.             int whiteSpaces = roofOfCastle.Length - 2;
  30.             for (int currRow = 0; currRow < size - 3; currRow++)
  31.             {
  32.                 Console.WriteLine("|" + new string(' ', whiteSpaces) + "|");
  33.             }
  34.  
  35.             //printing the penultimate row
  36.             Console.WriteLine("|" +
  37.                               new string(' ', arrowUp + 1) +
  38.                               new string('_', botDash) +
  39.                               new string(' ', arrowUp + 1) +
  40.                               "|");
  41.  
  42.             Console.WriteLine("\\" +
  43.                               new string('_', arrowUp) +
  44.                               "/" +
  45.                               new string(' ', botDash) +
  46.                               "\\" +
  47.                               new string('_', arrowUp) +
  48.                               "/");
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement