skipter icon

Draw X - C#

skipter | PRO | 06/04/17 07:00:55 PM UTC | 0 ⭐ | 313 👁️ | Never ⏰ | []
C# |

590 B

|

None

|

0 👍

/

0 👎

using System;
class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
 
        Console.WriteLine("x" + new string(' ', n - 2) + "x");
        for (int i = 1; i < n / 2; i++)
        {
            Console.WriteLine(new string(' ', i) + "x" + new string(' ', (n - 2) - i * 2) + "x" + new string(' ', i));
        }
        Console.WriteLine(new string(' ', n / 2) + "x");
        for (int j = 0; j < (n - 1) / 2; j++)
        {
            Console.WriteLine(new string(' ', (n / 2)-1  - j) + "x" + " " + new string(' ', j * 2) + "x");
        }
 
    }   
}

Comments