Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace MMTask
- {
- public class Program
- {
- public static void Main()
- {
- int input = int.Parse(Console.ReadLine());
- int halvedRows = (input / 2) + 1;
- List<string> figure = new List<string>();
- StringBuilder drawer = new StringBuilder();
- DrawUpperPart(input, halvedRows, drawer, figure);
- DrawBottomPart(input, halvedRows, drawer, figure);
- foreach (var row in figure)
- {
- Console.WriteLine($"{row}{row}");
- }
- }
- public static void DrawUpperPart(int input, int rows, StringBuilder drawer, List<string> figure)
- {
- for (int i = 0; i < rows; i++)
- {
- drawer.Clear();
- drawer.Append(new string('-', input - i));
- drawer.Append(new string('*', input + (2 * i)));
- drawer.Append(new string('-', input - (2 * i)));
- drawer.Append(new string('*', input + (2 * i)));
- drawer.Append(new string('-', input - i));
- figure.Add(drawer.ToString());
- }
- }
- public static void DrawBottomPart(int input, int rows, StringBuilder drawer, List<string> figure)
- {
- for (int i = 0; i < rows; i++)
- {
- drawer.Clear();
- drawer.Append(new string('-', input - rows - i));
- drawer.Append(new string('*', input));
- drawer.Append(new string('-', i * 2 + 1));
- drawer.Append(new string('*', (input * 2) - i * 2 - 1));
- drawer.Append(new string('-', i * 2 + 1));
- drawer.Append(new string('*', input));
- drawer.Append(new string('-', input - rows - i));
- figure.Add(drawer.ToString());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement