C program to validate date (Check date is valid or not)
This program will read date from user and validate whether entered date is correct or not with checking of leap year. The logic behind to implement this program,
- Enter date.
- Check year validation, if year is not valid print error.
- If year is valid, check month validation (i.e. month is between 1 to 12), if month is not valid print error.
- If month is valid, then finally check day validation with leap year condition, here we will day range from 1 to 30, 1 to 31, 1 to 28 and 1 to 29.
- If day is valid print date is correct otherwise print error.