Advertisement
Guest User

Untitled

a guest
Apr 28th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2.  
  3. namespace DrawFort
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             // User input
  10.             int n = int.Parse(Console.ReadLine());
  11.             int width = 2 * n;
  12.  
  13.             // Top part
  14.             int accentCount = n / 2;
  15.             int underlineCount = width - 2 * (accentCount + 2);
  16.             Console.WriteLine("/{0}\\{1}/{0}\\",
  17.                 new string('^', accentCount),
  18.                 new string('_', underlineCount));
  19.  
  20.             // Middle part
  21.             for ( int i = 0; i < n - 2; i++ )
  22.             {
  23.                 if ( i == n - 3 )
  24.                 {
  25.                     Console.WriteLine("|{0}{1}{0}|",
  26.                         new string(' ', n / 2 + 1),
  27.                         new string('_', underlineCount));
  28.                 }
  29.                 else
  30.                 {
  31.                     Console.WriteLine("|{0}|", new string(' ', width - 2));
  32.                 }
  33.             }
  34.  
  35.             // Bottom part
  36.             Console.WriteLine("\\{0}/{1}\\{0}/",
  37.                 new string('_', accentCount),
  38.                 new string(' ', underlineCount));
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement