simonradev

Fifth

Apr 30th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.14 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 Rocket
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int size = int.Parse(Console.ReadLine());
  14.  
  15.             char dot = '.';
  16.             char forwardSlash = '/';
  17.             char backSlash = '\\';
  18.             char emptySpace = ' ';
  19.             char asterisk = '*';
  20.             char pipe = '|';
  21.  
  22.             int backgroundSymbolsCount = ((size * 3) - 2) / 2;
  23.             int middleSymbolsCount = 0;
  24.  
  25.             //printing the top part
  26.             for (int currPart = 0; currPart < size; currPart++)
  27.             {
  28.                 string background = new string(dot, backgroundSymbolsCount);
  29.                 string middlePart = new string(emptySpace, middleSymbolsCount);
  30.  
  31.                 Console.WriteLine(background + forwardSlash + middlePart + backSlash + background);
  32.  
  33.                 backgroundSymbolsCount--;
  34.                 middleSymbolsCount += 2;
  35.             }
  36.  
  37.             //printing the middle part
  38.             backgroundSymbolsCount++;
  39.             middleSymbolsCount -= 2;
  40.             for (int currPart = 0; currPart < size * 2 + 1; currPart++)
  41.             {
  42.                 char borderSymbol = currPart == 0 ? asterisk : pipe;
  43.                 char middlySymbol = currPart == 0 ? asterisk : backSlash;
  44.  
  45.                 string background = new string(dot, backgroundSymbolsCount);
  46.                 string middlePart = new string(middlySymbol, middleSymbolsCount);
  47.  
  48.                 Console.WriteLine(background + borderSymbol + middlePart + borderSymbol + background);
  49.             }
  50.  
  51.             for (int currPart = 0; currPart < size / 2; currPart++)
  52.             {
  53.                 string background = new string(dot, backgroundSymbolsCount);
  54.                 string middlePart = new string(asterisk, middleSymbolsCount);
  55.                
  56.                 Console.WriteLine(background + forwardSlash + middlePart + backSlash + background);
  57.  
  58.                 backgroundSymbolsCount--;
  59.                 middleSymbolsCount += 2;
  60.             }
  61.         }
  62.     }
  63. }
Add Comment
Please, Sign In to add comment