#include<stdio.h> #include<stdlib.h> #include<math.h> int leap(int year) //if leap year we have to reduce one day { if((year%4==0&&year%100!=0)||(year%100==0&&year%400==0)) return -1; return 0; } int main(int argc,char *argv) { char *date=(char *)malloc(100); int day; int month; int year; int temp; int century[4]={4,2,0,6}; int centurycode; printf("\n enter the date,month and year in the following format"); printf("\n dd/mm/yyyy"); scanf("%s",date); sscanf(date,"%d%*c%d%*c%d",&day,&month,&year); /* Error Checking*/ if(month>12 || day >31) { printf("in valid date"); return; } if(month==2) { if(leap(year)&&day>29){ printf("invalid date");return;} if(day>28){ printf("invalid date");return;} } if(month==4||month==9||month==6||month==11) { if(day>30){