Advertisement
koksibg

house

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