skipter icon

C# Drawing X with oddNumber

skipter | PRO | 09/24/17 05:51:16 PM UTC | 0 ⭐ | 355 👁️ | Never ⏰ | []
C# |

710 B

|

None

|

0 👍

/

0 👎

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

Comments