Advertisement
Guest User

Untitled

a guest
Feb 4th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.06 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _03.Task
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int width = (n + n) - 1;
  15.             int freeSpace = n - 1;
  16.             int slash = n - 2;
  17.             int x = 0;
  18.             Console.Write(new string(' ', freeSpace));
  19.             Console.Write(new string(':', n));
  20.             Console.WriteLine();
  21.             freeSpace--;
  22.             for (int i = 0; i < n - 2; i++)
  23.             {
  24.                 Console.Write(new string(' ', freeSpace));
  25.                 Console.Write(new string(':', 1));
  26.                 Console.Write(new string('/', slash));
  27.                 Console.Write(new string(':', 1));
  28.                 Console.Write(new string('X', x));
  29.                 Console.Write(new string(':', 1));
  30.                 x++;
  31.                 freeSpace--;
  32.                 Console.WriteLine();
  33.             }
  34.  
  35.             Console.Write(new string(':', n - 1));
  36.             Console.Write(new string(':', 1));
  37.             Console.Write(new string('X', x));
  38.             Console.Write(new string(':', 1));
  39.             Console.WriteLine();
  40.  
  41.              freeSpace = n - 2;
  42.              x--;
  43.             for (int i = 0; i < n - 1; i++)
  44.             {
  45.                 if (i + 1 == n - 1)
  46.                 {
  47.                     Console.Write(new string(':', 1));
  48.                     Console.Write(new string(':', freeSpace));
  49.                     Console.Write(new string(':', 1));
  50.                     Console.WriteLine();
  51.                     break;
  52.                 }
  53.                 Console.Write(new string(':', 1));
  54.                 Console.Write(new string(' ', freeSpace));
  55.                 Console.Write(new string(':', 1));
  56.                 Console.Write(new string('X', x));
  57.                 Console.Write(new string(':', 1));
  58.                
  59.                 x--;
  60.                 Console.WriteLine();
  61.             }
  62.  
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement