SHARE
TWEET

Untitled

a guest Feb 21st, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace MMTask
  7. {
  8.     public class Program
  9.     {
  10.         public static void Main()
  11.         {
  12.             int n = int.Parse(Console.ReadLine());
  13.             int halvedRows = (n / 2) + 1;
  14.             string leftSide = string.Empty;
  15.             string rightSide = string.Empty;
  16.             List<string> figure = new List<string>();
  17.  
  18.             for (int i = 0; i < halvedRows; i++)
  19.             {
  20.                 leftSide = $"{new string('-', n - i)}{new string('*', n + (2 * i))}{new string('-', (n / 2) - i)}";
  21.                 rightSide = new string(leftSide.Reverse().ToArray());
  22.                 figure.Add($"{leftSide}-{rightSide}");
  23.             }
  24.  
  25.             for (int i = 0; i < halvedRows; i++)
  26.             {
  27.                 leftSide = $"{new string('-', (n / 2) - i)}{new string('*', n)}{new string('-', (i * 2) + 1)}{new string('*', n - 1 - i)}";
  28.                 rightSide = new string(leftSide.Reverse().ToArray());
  29.                 figure.Add($"{leftSide}*{rightSide}");
  30.             }
  31.  
  32.             foreach (var row in figure)
  33.             {
  34.                 Console.WriteLine($"{row}{row}");
  35.             }
  36.         }
  37.     }
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top