Advertisement
Pazzobg

Programming Basics Exams/28AUG16/05. Axe

Mar 11th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05.Axe
  4. {
  5.     class Axe
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.             int spaceBefore = 3 * n;
  11.             int spaceIn = 0;
  12.             int spaceAft = 0;
  13.             int l = n / 2;
  14.             for (int i = 0; i < n; i++)
  15.             {
  16.                 spaceIn = i;
  17.                 spaceAft = (2 * n) - (2 + i);
  18.                 Console.WriteLine("{0}*{1}*{2}", new string('-', spaceBefore), new string('-', spaceIn), new string('-', spaceAft));
  19.             }
  20.             for (int i = 0; i < l; i++)
  21.             {
  22.                 Console.WriteLine("{0}*{1}*{2}", new string('*', spaceBefore), new string('-', spaceIn), new string('-', spaceAft));
  23.             }
  24.             for (int i = 0; i < l; i++)
  25.             {
  26.                 if (i != (l - 1))
  27.                 {
  28.                     Console.WriteLine("{0}*{1}*{2}", new string('-', spaceBefore), new string('-', spaceIn), new string('-', spaceAft));
  29.                     spaceBefore--;
  30.                     spaceAft--;
  31.                     spaceIn += 2;
  32.                 }
  33.                 else
  34.                 {
  35.                     Console.WriteLine("{0}*{1}*{2}", new string('-', spaceBefore), new string('*', spaceIn), new string('-', spaceAft));
  36.                 }
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement