bacco

Къщичка

Feb 10th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _7
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             int stars = 1;
  12.             if (n % 2 == 0)
  13.             {
  14.                 stars = stars + 1;
  15.             }
  16.             for (int i = 0; i < (n + 1) / 2; i++)
  17.             {
  18.                 int padding = ((n - stars) / 2);
  19.                 Console.Write(new string('-' , padding));
  20.                 Console.Write(new string('*' , stars));
  21.                 Console.Write(new string('-', padding));
  22.  
  23.                 stars += 2;
  24.                 Console.WriteLine();
  25.             }
  26.             for (int i = 0; i < n / 2; i++)
  27.             {
  28.                 Console.Write("|");
  29.                 Console.Write(new string('*', n - 2));
  30.                 Console.Write("|");
  31.  
  32.                 Console.WriteLine();
  33.             }
  34.         }
  35.     }
  36. }
Add Comment
Please, Sign In to add comment