title: C# - write a program that displays the calendar, asking just for the year and month, use System.DateTime
body: <p>I am stuck on this, i need help on how i can ask for user input to enter any year and any month, then that will output a monthly calendar for that specified year and month, i also need to use system.datetime
  This is the code i have so far and i dont think it is correct, any help is appreciated. Thanks</p>
  
  <pre><code>class Program
  {
      static int year = new int();
      static int month = new int();
      static int[,] calendar = new int[6, 7];
  
      static void Main(string[] args)
      {
          Console.Write("Enter the year? ");
          year = Convert.ToInt32(Console.ReadLine());
          Console.Write("Enter the month (January = 1, etc): ");
          month = Convert.ToInt32(Console.ReadLine());
  
          DrawHeader();
          FillCalendar();
          DrawCalendar();
          Console.ReadLine();
      }
  
      static void DrawHeader()
      {
          Console.Write("\n\n");
          Console.WriteLine("\t" + month);
          Console.WriteLine("Mo Tu We Th Fr Sa Su");
      }
  
      static void FillCalendar()
      {
          int days = DateTime.DaysInMonth(year, month);
          int currentDay = 1;
          for (int i = 0; i &lt; calendar.GetLength(0); i++)
          {
              for (int j = 0; j &lt; calendar.GetLength(1) &amp;&amp; currentDay &lt;= days; j++)
              {
                  if (i == 0 &amp;&amp; month &gt; j)
                  {
                      calendar[i, j] = 0;
                  }
                  else
                  {
                      calendar[i, j] = currentDay;
                      currentDay++;
                  }
              }
          }
      }
  
      static void DrawCalendar()
      {
          for (int i = 0; i &lt; calendar.GetLength(0); i++)
          {
              for (int j = 0; j &lt; calendar.GetLength(1); j++)
              {
                  if (calendar[i, j] &gt; 0)
                  {
                      if (calendar[i, j] &lt; 10)
                      {
                          Console.Write(" " + calendar[i, j] + " ");
                      }
                      else
                      {
                          Console.Write(calendar[i, j] + " ");
                      }
                  }
                  else
                  {
                      Console.Write("   ");
                  }
              }
              Console.WriteLine("");
          }
      }
  }
  </code></pre>