Hey all... Well im supposed to create a program in which you input the day/month/year in digit form and the output tells you whether the date you've entered is valid.
For example if you enter 30 in February it should give you a false statement ... and so i've created this program
Code:
#include <stdio.h>
int main ()
{
  
  int month;   /* input - month */
  int day;     /* input - day   */
  int year;    /* input - year  */
  
  /* Prompt the user and read in a month digit */
  printf ("Please enter a month in number form. >");
  scanf ("%d", &month);

  /* Prompt the user and read in a day
  printf ("Please enter a day (1-31). >");
  scanf ("%d", &day); */

  /* Prompt the user and read in a year */
  printf ("Please enter a year (4 digits). >");
  scanf ("%d", &year);
  
if ((month==1) && (day<=31)) {
printf("This date is valid")
}
else if ((month==1) &&  (day>31)){
printf("This date is NOT valid")
}
  
  
else if ((month==2) && (year%400==0) && (day<=29)) {
printf("This date is valid")
}
else if ((month==2) && (year%400==0) && (day>29)){
printf("This date is NOT valid")
}
else if ((month==2) && (year%100==0) && (day<=28)) {
printf("This date is valid")
} 
else if ((month==2) && (year%100==0) && (day>28) {
printf("This date is valid")
}
else if ((month==2) && (year%4==0) && (day<=29) {
printf("This date is valid")
}
else if ((month==2) && (year%4==0) && (day>29) {
printf("This date is NOT valid")
}
  
        else if ((month==3) && (day<=30)) {
        printf("This date is valid")
        }
        else if ((month==3) &&  (day>30)){
        printf("This date is NOT valid")
        }

        else if ((month==4) && (day<=31)) {
        printf("This date is valid")
        }
        else if ((month==4) &&  (day>30)){ 
        printf("This date is NOT valid")
        }
                 
                else if ((month==5) && (day<=31)) {
                printf("This date is valid")
                }
                else if ((month==5) &&  (day>31)){
                printf("This date is NOT valid")
                }
                        
                else if ((month==6) && (day<=30)) {
                printf("This date is valid")
                }
                else if ((month==6) &&  (day>30)){ 
                printf("This date is NOT valid")
                }
                
                        else if ((month==7) && (day<=31)) {
                        printf("This date is valid")
                        }
                        else if ((month==7) &&  (day>31)){
                        printf("This date is NOT valid")
                        }
                
                        else if ((month==8) && (day<=31)) {
                        printf("This date is valid")
                        }
                        else if ((month==8) &&  (day>31)){ 
                        printf("This date is NOT valid")
                        }

                                else if ((month==9) && (day<=30)) {
                                printf("This date is valid")
                                }
                                else if ((month==9) &&  (day>30)){
                                printf("This date is NOT valid")
                                }
                        
                        
                                else if ((month==10) && (day<=31)) {
                                printf("This date is valid")
                                }
                                else if ((month==10) &&  (day>31)){
                                printf("This date is NOT valid")
                                }
                                
                                        else if ((month==11) && (day<=30)) {
                                        printf("This date is valid")
                                        }
                                        else if ((month==11) &&  (day>30)){
                                        printf("This date is NOT valid")
                                        }
                                
                                        else if ((month==12) && (day<=31)) {
                                        printf("This date is valid")
                                        }
                                        else if ((month==12) &&  (day>31)){ 
                                        printf("This date is NOT valid")
                                        }


}
And i get these errors ....:
Project4.c: In function `main':
Project4.c:24: parse error before `}'
Project4.c:27: parse error before `}'
Project4.c:32: parse error before `}'
Project4.c:35: parse error before `}'
Project4.c:38: parse error before `}'
Project4.c:39: parse error before `{'
Project4.c:41: parse error before `}'

Can anyone help me out pleasE? Thanks!