Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _09.House
- {
- class House
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- var stars = 1;
- if (n % 2 == 0)
- {
- stars++;
- }
- var roofLength = (int)Math.Ceiling(n / 2f);
- for (int i = 0; i < roofLength; i++)
- {
- var padding = (n - stars) / 2;
- var line = new string('-', padding)
- + new string('*', stars)
- + new string('-', padding);
- Console.WriteLine(line);
- stars += 2;
- }
- for (int i = 0; i < n/2; i++)
- {
- var line = "|" + new string('*', n - 2) + "|";
- Console.WriteLine(line);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement