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 TriangleFigure
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- string firstRow = new string('#', 4 * n + 1);
- Console.WriteLine(firstRow);
- int counterDots = 1;
- int counterHashTags = (4 * n - 2) / 2;
- int counterEmptySpacies = 1;
- for (int i = 0; i < n; i++)
- {
- int counterEmptyMiddleRow = (counterEmptySpacies - 3) / 2;
- string dots = StringCreater(".", counterDots);
- string hashTags = StringCreater("#", counterHashTags);
- string emptySpacies = StringCreater(" ", counterEmptySpacies);
- string emptySpMiddle = StringCreater(" ", counterEmptyMiddleRow);
- if (i == n / 2)
- {
- Console.WriteLine($"{dots}{hashTags}{emptySpMiddle}(@){emptySpMiddle}" +
- $"{hashTags}{dots}");
- }
- else
- {
- Console.WriteLine($"{dots}{hashTags}{emptySpacies}" +
- $"{hashTags}{dots}");
- }
- counterDots++;
- counterHashTags -= 2;
- counterEmptySpacies += 2;
- }
- int counterDotsDown = n + 1;
- int counterHash = (4 * n - 1) / 2;
- for (int i = 0; i < n; i++)
- {
- string dots = StringCreater(".", counterDotsDown);
- string hash = StringCreater("#", counterHash);
- Console.WriteLine($"{dots}{hash}{dots}");
- counterDotsDown++;
- counterHash -= 2;
- }
- }
- public static string StringCreater(string text, int repeatCount)
- {
- string repeatedText = string.Empty;
- for (int currentCount = 0; currentCount < repeatCount; currentCount++)
- {
- repeatedText += text;
- }
- return repeatedText;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement