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 ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- var stars = 1;
- if (n % 2 == 0) stars++;
- for (int i=0; i<(n+1)/2; i++)
- {
- var padding = (n - stars)/2;
- Console.Write(new string('-', padding));
- Console.Write(new string('*', stars));
- Console.WriteLine(new string('-', padding));
- stars+=2;
- }
- for (int j=1; j<=n/2; j++)
- {
- Console.Write("|");
- Console.Write(new string('*', n - 2));
- Console.WriteLine("|");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment