Program that tells if a date is valid in C
Validation is a specific task, distinct from receiving input, so it deserves to have its own function.

The code suffers from excessive nesting, which could be improved by putting else if at the same indentation level. However, another problem is that some of the checks are affirmative and some of them are negative, which makes the code harder to follow.

Since the validation depends mostly on the month, I'd write it this way, with a switch:

int isValid(int dd, int mm, int yy) {
    if (dd &lt;= 0) return 0;
    switch (mm) {
      case 1: case 3: case 5: case 7:
      case 8: case 10: case 12:
        return dd &lt;= 31;
      case 4: case 6: case 9: case 11:
        return dd &lt;= 30;
      case 2:
        return dd &lt;= 28 + (yy % 4 == 0);
      default:
        return 0;  /* invalid month */
    }
}


Then, in main():

if ( 3 == scanf("%d/%d/%d",&amp;dd,&amp;mm,&amp;yy) &amp;&amp;
     isValid(dd, mm, yy) ) {
    puts("Valid date");
} else {
    puts("Invalid date");
}


Note that validating the return value from scanf() is important too.

The code doesn't handle the Gregorian correction properly, such as for year 1900.