SHARE
TWEET

Untitled

a guest May 29th, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.  
  9.         Console.Write("x");
  10.         Console.Write(new string(' ', n - 2));
  11.         Console.WriteLine("x");
  12.         int counter = 4;
  13.         int middleCounter = 1;
  14.         int downCounter = 1;
  15.  
  16.         for (int i = 1; i <= n - 4; i++)
  17.         {
  18.  
  19.             Console.Write(new string(' ', i));
  20.             Console.Write("x");
  21.             Console.Write(new string(' ', n - counter));
  22.             Console.WriteLine("x");
  23.  
  24.             counter+=2;
  25.             middleCounter++;
  26.             if ((n - counter) < 1)
  27.             {
  28.                 break;
  29.             }
  30.         }
  31.  
  32.         Console.Write(new string(' ', middleCounter));
  33.         Console.WriteLine("x");
  34.         for (int j = 1; j <= n - 4; j++)
  35.         {
  36.             middleCounter--;
  37.             if (middleCounter == 0)
  38.             {
  39.                 break;
  40.             }
  41.             Console.Write(new string(' ', middleCounter));
  42.             Console.Write("x");
  43.             Console.Write(new string(' ', downCounter));
  44.             downCounter += 2;
  45.             Console.WriteLine("x");
  46.         }
  47.  
  48.  
  49.         Console.Write("x");
  50.         Console.Write(new string(' ', n - 2));
  51.         Console.WriteLine("x");
  52.     }
  53. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top