TodorovP

05. Arrow

Apr 9th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.74 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 _05_Arrow
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var n = int.Parse(Console.ReadLine()); //[4...60] n + 5
  14.  
  15.             //Top part            
  16.             for (int i = 0; i < (n + 5) / 2; i++)
  17.             {
  18.                 string lineUpBord = new string('_', (n + 5) / 2 - i);
  19.  
  20.                 if (i == 0) Console.WriteLine("{0}^{0}", lineUpBord);
  21.                 else if (i == 1) Console.WriteLine("{0}/|\\{0}", lineUpBord);
  22.                 else
  23.                 {
  24.                     string dotsTopIn = new string('.', i - 2);
  25.                     Console.WriteLine("{0}/{1}|||{1}\\{0}", lineUpBord, dotsTopIn);
  26.                 }
  27.             }
  28.             for (int i = 2; i >= 1; i--)
  29.             {
  30.                 string linesBord = new string('_', (n - 2 * i) / 2);
  31.                 string dotsIn = new string('.', i);                
  32.                 Console.WriteLine("{0}/{1}|||{1}\\{0}", linesBord, dotsIn);
  33.             }
  34.  
  35.             //Middle part
  36.             string linesBordMid = new string('_', (n + 2) / 2);
  37.             for (int i = 0; i < n + 1; i++)
  38.             {
  39.                 if (i == n) Console.WriteLine("{0}~~~{0}", linesBordMid);
  40.                 else Console.WriteLine("{0}|||{0}", linesBordMid);
  41.             }
  42.  
  43.             //Bottom part
  44.             for (int i = 0; i < n / 2; i++)
  45.             {
  46.                 string linesBottom = new string('_', (n - 2 * i) / 2);
  47.                 string dotsBottom = new string('.', i);
  48.                 Console.WriteLine("{0}//{1}!{1}\\\\{0}", linesBottom, dotsBottom);
  49.             }
  50.         }
  51.     }
  52. }
Add Comment
Please, Sign In to add comment