grach

House

Jul 19th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 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 House
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.  
  15.             int firststars = 1;
  16.             if (n % 2 == 0)
  17.                 firststars = 2;
  18.             for (int i = 0; i < (n + 1) / 2; i++)
  19.             {
  20.                 Console.WriteLine("{0}{1}{0}",
  21.                     new string('-', (n - firststars) / 2),
  22.                     new string('*', firststars));
  23.                 firststars += 2; //firststars = firststars + 2;
  24.             }
  25.             for (int i = 0; i < n / 2; i++)
  26.             {
  27.                 Console.WriteLine("|{0}|", new string('*', n - 2));
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment