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