Advertisement
skipter

C# Drawing X with oddNumber

Sep 24th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. namespace ConsoleApp1
  2. {
  3.     using System;
  4.     public class Program
  5.     {
  6.         static void Main()
  7.         {
  8.             int num = int.Parse(Console.ReadLine());
  9.  
  10.             for (int i = 0; i < num / 2; i++)
  11.             {
  12.                 Console.WriteLine(new string(' ', i) + "x" + new string(' ', (num - 2) - i * 2) + "x" + new string(' ', i));
  13.             }
  14.             Console.WriteLine(new string(' ', num / 2) + "x" + new string(' ', num / 2));
  15.             for (int j = 0; j < num / 2; j++)
  16.             {
  17.                 Console.WriteLine(new string(' ', ((num / 2 ) - 1) - j ) + "x" + new string(' ', (j + 1) * 2 - 1) + "x" + new string(' ', ((num / 2) - 1)));
  18.             }
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement