title: Days between dates will not compile
body: <p>I have been trying to get this to work. I need to input 2 dates (MM DD) and then have the program tell me the amount of days between the 2 dates. But for some reason when i try to use month 2 (February) I dont think its registering that I indicated it having only 28 days. Also when i enter the same date i cant get it to say "0". Please help thank you</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  //constructs dates for calculation
  struct date{
      int month;
      int day;
  };//end date
  
  int main()
  {
      struct date first, second; //creates 2 dates to calculate
      int finalDays = 0;
      int total = 0;
      int i = 0;
      int valid=0;
  
      printf("Enter first date \n");
      scanf("%d %d", &amp;first.month, &amp;first.day); //user input: first date
      if (first.month == 1||3||5||7||8||10){
         if(first.day &gt; 31){
          printf("Invalid Day\n");
          valid += 1;
         }
      }
      else if (first.month == 4||6||9||11 ){
          if (first.day &gt; 30){
           printf("Invalid Day\n");
           valid += 1;
          }
      }
      else if (first.month == 2){
          if(first.day &gt; 28){
           printf("Invalid Day");
           valid += 1;
          }
      }
  
      printf("Enter second date\n");
      scanf("%d %d", &amp;second.month, &amp;second.day); // user input: second date
      if (second.month == 1||3||5||7||8||10){
         if(second.day &gt; 31){
          printf("Invalid Day\n");
          valid += 1;
         }
      }
      else if (second.month == 4||6||9||11 ){
          if (second.day &gt; 30){
           printf("Invalid Day\n");
           valid += 1;
          }
      }
      else if (second.month ==2){
          if(second.day &gt; 28){
           printf("Invalid Day");
           valid += 1;
          }
      }
  
      if (first.month == second.month &amp;&amp; first.day == second.day){
          printf("Days between dates: 0");
          valid += 1;
      }
  
      //Prints statement if month is invalid
      if(first.month &gt; 12 || second.month &gt; 12 || first.month&lt;1 || second.month&lt;1){
          printf("Invalid Date: Invalid month");
      }
  
      //Prints statement if second date precedes first
      if(second.month&lt;first.month){
          printf("Invalid. Second date cannot precede first date.");
      }
      if (second.month==first.month &amp;&amp; second.day&lt;first.day){
          printf("Invalid. Second date cannot precede first date.");
      }
  
      if(first.month==second.month){
          finalDays = (second.day - first.day);
          printf("Days between dates: %d", finalDays);
          valid+=1;
      }
  
      if(first.month == 1||3||5||7||8||10||12)         // Days remaining in first month
          total = 31 - first.day;
      else if(first.month == 4||6||9||11)
          total = 30 - first.day;
      else if(first.month == 2)
          total = 28 - first.day;
  
      for(i = first.month + 1; i &lt; second.month; i++)
      {
        if(i == 3||5||7||8||10||12)
            total += 31;
        else if(i == 4||6||9||11)
            total += 30;
      }
      total += second.day;
  
      if(valid == 0){
      printf("First date: %d %d \n", first.month, first.day);
      printf("Second date: %d %d \n", second.month, second.day);
      printf("Days between dates: %d", total);
      }
  
      return 0;
  } //end main
  </code></pre>