Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace DrawFort
- {
- class Program
- {
- static void Main()
- {
- var input = ushort.Parse(Console.ReadLine());
- var width = (ushort)(input * 2);//Width of the fort
- var numberOfCarets = (ushort)(input / 2);//The number of '^' symbols in a single sequence
- var numberOfUnderscores = (ushort)(width - (numberOfCarets * 2) - 4);//The number of '_' symbols in a single sequence
- var underscores = new string('_', numberOfUnderscores);
- var carets = new string('^', numberOfCarets);
- for (ushort row = 0; row < input; row++)
- {
- if (row == 0) Console.WriteLine(@"/{0}\{1}/{0}\", carets, underscores);
- else if (row == input - 2) Console.WriteLine(@"|{0}{1}{0}|", new string(' ', (width - numberOfUnderscores - 2) / 2), underscores);
- else if (row == input - 1) Console.WriteLine(@"\{0}/{1}\{0}/", new string('_', input/2), new string(' ', 2 * (input - numberOfCarets) - 4));
- else Console.WriteLine("|{0}|", new string(' ', width - 2));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement