Advertisement
Niicksana

Crown

Dec 15th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.44 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 _5.Crown
  8. {
  9.     class Crown
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Exam - 7 May 2017
  14.             int n = int.Parse(Console.ReadLine());
  15.  
  16.             int spaces = ((2 * n - 1) - 3) / 2;
  17.             int firstDots = 0;
  18.             int centralDots = 1;
  19.  
  20.             Console.Write("@");
  21.             Console.Write(new string(' ', spaces));
  22.             Console.Write("@");
  23.             Console.Write(new string(' ', spaces));
  24.             Console.WriteLine("@");
  25.             spaces--;
  26.  
  27.             for (int row = 1; row <= n / 2 + 1; row++)
  28.             {
  29.                 if (row == 1)
  30.                 {
  31.                     Console.Write("*");
  32.                     Console.Write(new string('.', firstDots));
  33.                     Console.Write("*");
  34.                     Console.Write(new string(' ', spaces));
  35.                     Console.Write("*");
  36.                     Console.Write(new string(' ', spaces));
  37.                     Console.Write("*");
  38.                     Console.Write(new string('.', firstDots));
  39.                     Console.WriteLine("*");
  40.                     firstDots++;
  41.                     spaces -= 2;
  42.  
  43.                 }
  44.  
  45.                 else if (row != 1 && row != n / 2 + 1)
  46.                 {
  47.                     if (spaces >= 0)
  48.                     {
  49.                         Console.Write("*");
  50.                         Console.Write(new string('.', firstDots));
  51.                         Console.Write("*");
  52.                         Console.Write(new string(' ', spaces));
  53.                         Console.Write("*");
  54.                         Console.Write(new string('.', centralDots));
  55.                         Console.Write("*");
  56.                         Console.Write(new string(' ', spaces));
  57.                         Console.Write("*");
  58.                         Console.Write(new string('.', firstDots));
  59.                         Console.WriteLine("*");
  60.                         firstDots++;
  61.                         spaces -= 2;
  62.                         centralDots += 2;
  63.                     }
  64.  
  65.                     else
  66.                     {
  67.                         Console.Write("*");
  68.                         Console.Write(new string('.', firstDots));
  69.                         Console.Write("*");
  70.                         Console.Write(new string('.', centralDots));
  71.                         Console.Write("*");
  72.                         Console.Write(new string('.', firstDots));
  73.                         Console.WriteLine("*");
  74.                         firstDots++;
  75.                         spaces -= 2;
  76.                         centralDots += 2;
  77.                     }
  78.                 }
  79.  
  80.                 else if (row == n / 2 + 1)
  81.                 {
  82.                     int stars = (((2 * n - 1) - (2 * firstDots)) - 3) / 2;
  83.                     Console.Write("*");
  84.                     Console.Write(new string('.', firstDots));
  85.                     Console.Write(new string('*', stars));
  86.                     Console.Write(".");
  87.                     Console.Write(new string('*', stars));
  88.                     Console.Write(new string('.', firstDots));
  89.                     Console.WriteLine("*");
  90.                 }
  91.             }
  92.  
  93.             for (int row = 1; row <= 2; row++)
  94.             {
  95.                 Console.WriteLine(new string('*', 2 * n -1));
  96.             }
  97.         }
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement