Advertisement
Niicksana

Axe

Dec 4th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.96 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 Axe
  8. {
  9.     class Axe
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Exam - 28 August 2016
  14.             int n = int.Parse(Console.ReadLine());
  15.  
  16.             int firstDashes = 3 * n;
  17.             int centralDashes = 0;
  18.             int lastDashes = (5 * n) - ((firstDashes + centralDashes) + 2);
  19.  
  20.             for (int row1 = 1; row1 <= n; row1++)
  21.             {
  22.                 Console.Write(new string('-', firstDashes));
  23.                 Console.Write("*");
  24.                 Console.Write(new string('-', centralDashes));
  25.                 Console.Write("*");
  26.                 Console.WriteLine(new string('-', lastDashes));
  27.                 centralDashes++;
  28.                 lastDashes--;
  29.             }
  30.  
  31.             int dashes = n - 1;
  32.             int LastDashes = (5 * n) - ((firstDashes + dashes) + 2);
  33.  
  34.             for (int row2 = 1; row2 <= n / 2; row2++)
  35.             {
  36.                 Console.Write(new string('*', firstDashes));
  37.                 Console.Write("*");
  38.                 Console.Write(new string('-', dashes));
  39.                 Console.Write("*");
  40.                 Console.WriteLine(new string('-', LastDashes));
  41.             }
  42.  
  43.             for (int row3 = 1; row3 < (n / 2) ; row3++)
  44.             {
  45.                 Console.Write(new string('-', firstDashes));
  46.                 Console.Write("*");
  47.                 Console.Write(new string('-', dashes));
  48.                 Console.Write("*");
  49.                 Console.WriteLine(new string('-', LastDashes));
  50.                 firstDashes--;
  51.                 dashes += 2;
  52.                 LastDashes--;
  53.             }
  54.  
  55.             Console.Write(new string('-', firstDashes));
  56.             Console.Write("*");
  57.             Console.Write(new string('*', dashes));
  58.             Console.Write("*");
  59.             Console.WriteLine(new string('-', LastDashes));
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement