Advertisement
EmoRz

House

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