Advertisement
Spocoman

Draw Fort

Oct 11th, 2023
657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace DrawFort
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             int x = n > 4 ? n * 2 - (n / 2 + 2) * 2 : 0;
  12.  
  13.             Console.WriteLine("/{0}\\{1}/{0}\\", new string('^', n / 2), new string('_', x));
  14.  
  15.             for (int i = 0; i < n - 3; i++)
  16.             {
  17.                 Console.WriteLine("|{0}|", new string(' ', n * 2 - 2));
  18.             }
  19.  
  20.             Console.WriteLine("|{0}{1}{0}|", new string(' ', (n * 2 - (x + 2)) / 2), new string('_', x));
  21.  
  22.             Console.WriteLine("\\{0}/{1}\\{0}/", new string('_', n / 2), new string(' ', x));
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement