Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace House
- {
- class Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- if (n % 2 == 0)
- {
- var dash = n / 2 - 1;
- var stars = 2;
- for (int row = 1; row <= n; row+=2)
- {
- if (dash >= 0) Console.Write(new string('-', dash));
- Console.Write(new string('*', stars));
- if (dash >= 0) Console.WriteLine(new string('-', dash));
- dash -= 1;
- stars += 2;
- }
- }
- else
- {
- var dash = n / 2;
- var stars = 1;
- for (int row = 1; row <= n; row+=2)
- {
- if (dash >= 0) Console.Write(new string('-', dash));
- Console.Write(new string('*', stars));
- if (dash >= 0) Console.WriteLine(new string('-', dash));
- dash -= 1;
- stars += 2;
- }
- }
- for (int row = 1; row <= n / 2; row++)
- {
- Console.Write("|");
- Console.Write(new string('*', n - 2));
- Console.WriteLine("|");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement