Advertisement
AlexTasev

5_SublimeLogo

Apr 28th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.80 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _5_SublimeLogo
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             int width = 2 * n;
  12.  
  13.             char space = ' ';
  14.             char star = '*';
  15.  
  16.             int spacesCount = width - 2;
  17.             int starsCount = 2;
  18.  
  19.             // Upper Part
  20.  
  21.             for (int i = 1; i <= n; i++)
  22.             {
  23.                 Console.WriteLine(new string(space, spacesCount) + new string(star, starsCount));
  24.                 spacesCount -= 2;
  25.                 starsCount += 2;
  26.             }
  27.  
  28.             // Middle Part
  29.  
  30.             starsCount = n * 2 -2;
  31.  
  32.             for (int i = 1; i <= 2; i++)
  33.             {
  34.                 Console.WriteLine(new string(star, starsCount));
  35.                 starsCount -= 2;
  36.             }
  37.  
  38.             starsCount = width - 2;
  39.  
  40.             for (int i = 1; i <= 2; i++)
  41.             {
  42.                 Console.WriteLine(new string(star, starsCount));
  43.                 starsCount += 2;
  44.             }
  45.  
  46.             spacesCount = 2;
  47.             starsCount = width - 2;
  48.             Console.WriteLine((new string(space, spacesCount) + new string(star, starsCount)));
  49.  
  50.             spacesCount += 2;
  51.             starsCount -= 2;
  52.             Console.WriteLine((new string(space, spacesCount) + new string(star, starsCount)));
  53.  
  54.             spacesCount = 2;
  55.             starsCount = width - 2;
  56.             Console.WriteLine((new string(space, spacesCount) + new string(star, starsCount)));
  57.  
  58.             // Bottom Part
  59.  
  60.             spacesCount = 0;
  61.             starsCount = width;
  62.  
  63.             for (int i = 0; i < n; i++)
  64.             {
  65.                 Console.WriteLine(new string(star, starsCount));
  66.                 starsCount -= 2;
  67.             }
  68.         }
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement