title: C beginner programming help Calendar code update
body: <p>Implement a function that prints the calendar for a given month and year. First, prompt the user:</p>
  
  <p>Enter the month and year:</p>
  
  <p>Once the user enters a valid input (two integers separated by a space), print out the calendar in a format be similar to the output of the UNIX cal command. For example, if the user enters 03 2014, the output should be:</p>
  
  <p><a href="http://imgur.com/3LXleAr" rel="nofollow">http://imgur.com/3LXleAr</a></p>
  
  <p>An updated version of my code, sorry about indentation im new to stackflow, it wont let me simply just copy and paste my code says i have indentation problems:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  int main(){
  int year;
  int month, day;
  
  int days_in_month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
  
  char *months[]=
  {
  " ",
  "               January",
  "               February",
  "               March",
  "               April",
  "               May",
  "               June",
  "               July",
  "               August",
  "               September",
  "               October",
  "               November",
  "               December"
  };
  
  
  
  
  printf("Please enter a month and year: ");
  scanf("%d %d", &amp;month, &amp;year);
  
  
  if(((year%4==0) &amp;&amp; (year%100!=0)) || (year%400==0))
  {
      days_in_month[2] = 29;
  
  }
  else
  {
      days_in_month[2] = 28;
  
  }
  
  
  
  
      printf("%s", months[month]);
      printf("\nSun  Mon  Tue  Wed  Thu  Fri  Sat\n" );
  
  
      for ( day = 1; day &lt;= 1; day++ )
      {
          printf(" ");
      }
  
  
      for ( day = 1; day &lt;= days_in_month[month]; day++ )
      {
          printf("%2d", day );
  
  
          if ( ( day ) % 7 &gt; 0 ){
              printf("   " );
          }
          else{
              printf("\n " );
      }
      }
  return 0;
  }
  </code></pre>
  
  <p>What i need help with is that, i can print the correct year and month and the amount of days for each month, however im am completely stuck as to what to do to the code so that the progrma itself knows where to start printing the first day of the month i enter. For example if i put in 01 2014 the calendar should print january and put a 1 under wensday, 2 under thursday... and so on. 
  Thanks for the help.</p>