Advertisement
Guest User

DrawFort

a guest
Feb 19th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.56 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 DrawFort
  8. {
  9.     class DrawFort
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var n = int.Parse(Console.ReadLine());
  14.  
  15.             var colSize = n / 2;
  16.             var midPart = 2 * n - 4 - 2 * colSize;
  17.             // top
  18.             Console.Write("/");
  19.             Console.Write(new string('^', colSize));
  20.             Console.Write("\\");
  21.             Console.Write(new string('_', midPart));
  22.             Console.Write("/");
  23.             Console.Write(new string('^', colSize));
  24.             Console.WriteLine("\\");
  25.             //mid
  26.             for (int row = 1; row <= n - 2; row++)
  27.             {
  28.                 Console.Write("|");
  29.                 if (row == n - 2)
  30.                 {
  31.                     Console.Write(new string(' ', colSize + 1));
  32.                     Console.Write(new string('_', midPart));
  33.                     Console.Write(new string(' ', colSize + 1));
  34.                 }
  35.                 else
  36.                 {
  37.                     Console.Write(new string(' ', 2 * n - 2));
  38.                 }
  39.                 Console.WriteLine("|");
  40.             }
  41.             //bot
  42.             Console.Write("\\");
  43.             Console.Write(new string('_', colSize));
  44.             Console.Write("/");
  45.             Console.Write(new string(' ', midPart));
  46.             Console.Write("\\");
  47.             Console.Write(new string('_', colSize));
  48.             Console.WriteLine("/");
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement