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 FifthExcercise
- {
- class Program
- {
- static void Main(string[] args)
- {
- int size = int.Parse(Console.ReadLine());
- string singleRowToFormat = "{0}*{1}*{2}";
- char dash = '-';
- char asterisk = '*';
- int figureWidth = size * 5;
- int countOfLeftSymbols = size * 3;
- int countOfMiddleSymbols = 0;
- int countOfRightSymbols = figureWidth - (countOfLeftSymbols + 2);
- string leftPart = string.Empty;
- string middlePart = string.Empty;
- string rightPart = string.Empty;
- // first part
- for (int currentRow = 0; currentRow < size; currentRow++)
- {
- leftPart = new string(dash, countOfLeftSymbols);
- middlePart = new string(dash, currentRow);
- rightPart = new string(dash, countOfRightSymbols--);
- countOfMiddleSymbols = currentRow;
- Console.WriteLine(singleRowToFormat, leftPart, middlePart, rightPart);
- }
- int middleAndBottomPartRows = size / 2;
- // second part
- countOfRightSymbols = countOfMiddleSymbols;
- for (int currentRow = 0; currentRow < middleAndBottomPartRows; currentRow++)
- {
- leftPart = new string(asterisk, countOfLeftSymbols);
- middlePart = new string(dash, countOfMiddleSymbols);
- rightPart = new string(dash, countOfRightSymbols);
- Console.WriteLine(singleRowToFormat, leftPart, middlePart, rightPart);
- }
- // bottom part
- for (int currentRow = 1; currentRow <= middleAndBottomPartRows; currentRow++)
- {
- char middleSymbol = currentRow == middleAndBottomPartRows ? asterisk : dash;
- leftPart = new string(dash, countOfLeftSymbols--);
- middlePart = new string(middleSymbol, countOfMiddleSymbols);
- rightPart = new string(dash, countOfRightSymbols--);
- countOfMiddleSymbols += 2;
- Console.WriteLine(singleRowToFormat, leftPart, middlePart, rightPart);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement