Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- class Program
- {
- static void Main()
- {
- int n = 12;
- int midl = n / 2;
- StringBuilder lineLeft = new StringBuilder();
- StringBuilder lineRight = new StringBuilder();
- for (int i = 0; i < midl; i++)
- {
- if (i % 2 == 0)
- {//tish condition mark shen to ad space or slashes padding fil out the rest
- lineLeft.Append("/"); lineRight.Insert(0, '\\');
- Console.WriteLine(lineLeft.ToString().PadLeft((midl), '.') + lineRight.ToString().PadRight((midl), '.'));
- }
- else if (i % 2 == 1)
- {
- lineLeft.Append(" "); lineRight.Insert(0, ' ');
- Console.WriteLine(lineLeft.ToString().PadLeft((midl), '.') + lineRight.ToString().PadRight((midl), '.'));
- }
- }
- // change slashes direction
- lineLeft.Replace('/', '\\'); lineRight.Replace('\\', '/');
- Console.WriteLine(lineLeft.ToString().PadLeft((midl), '.') + lineRight.ToString().PadRight((midl), '.'));
- for (int i = 0; i < midl-1; i++)
- { // just remove inner element from the carpet padding fill up the rest wit dots. to lineLeft inner element is the last one
- // for lineRightinner element is the first - zero element.
- lineLeft.Remove(lineLeft.Length - 1, 1); lineRight.Remove(0, 1);
- Console.WriteLine(lineLeft.ToString().PadLeft((midl), '.') + lineRight.ToString().PadRight((midl), '.'));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement