Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- Console.Write("x");
- Console.Write(new string(' ', n - 2));
- Console.WriteLine("x");
- int counter = 4;
- int middleCounter = 1;
- int downCounter = 1;
- for (int i = 1; i <= n - 4; i++)
- {
- Console.Write(new string(' ', i));
- Console.Write("x");
- Console.Write(new string(' ', n - counter));
- Console.WriteLine("x");
- counter+=2;
- middleCounter++;
- if ((n - counter) < 1)
- {
- break;
- }
- }
- Console.Write(new string(' ', middleCounter));
- Console.WriteLine("x");
- for (int j = 1; j <= n - 4; j++)
- {
- middleCounter--;
- if (middleCounter == 0)
- {
- break;
- }
- Console.Write(new string(' ', middleCounter));
- Console.Write("x");
- Console.Write(new string(' ', downCounter));
- downCounter += 2;
- Console.WriteLine("x");
- }
- Console.Write("x");
- Console.Write(new string(' ', n - 2));
- Console.WriteLine("x");
- }
- }
Add Comment
Please, Sign In to add comment