Advertisement
Terziyski

Problem01 - X

May 28th, 2017
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.44 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 Problem01_X
  8. {
  9.     class Solution
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int number = int.Parse(Console.ReadLine());
  14.  
  15.             string symbol = "x";
  16.             int emptySpace = number - 2;
  17.  
  18.             Console.WriteLine(symbol + new string(' ', emptySpace) + symbol);
  19.  
  20.             for (int i = 0; i < number / 2 - 1; i++)
  21.             {
  22.                 for (int j = 0; j <= i; j++)
  23.                 {
  24.                     Console.Write(" ");
  25.                 }
  26.                 Console.Write(symbol);
  27.  
  28.                 for (int ki = 0; ki < ((emptySpace - 2) - i * 2); ki++)
  29.  
  30.                 {
  31.                     Console.Write(" ");
  32.  
  33.                 }
  34.                 Console.WriteLine(new string('x', 1));
  35.  
  36.             }
  37.             Console.WriteLine(new string(' ', number / 2) + "x" + new string(' ', number / 2));
  38.  
  39.             for (int i = 0; i < number / 2; i++)
  40.             {
  41.                 for (int j = 0; j < (number / 2 - 1) - i; j++)
  42.                 {
  43.                     Console.Write(" ");
  44.                 }
  45.                 Console.Write(symbol);
  46.  
  47.                 for (int k = 0; k <= i * 2; k++)
  48.                 {
  49.                     Console.Write(" ");
  50.                 }
  51.                 Console.WriteLine("x");
  52.             }
  53.  
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement