/*Program to determine if a year is a leap year or not*/ /*Date : 30:11:98*/ main() { int year,x; clrscr(); x=1; while(x!=0) { clrscr(); printf("\n"); printf("\n\t\tThis program will help you to determine whether a given year is\n\t\ta leap year or not.\n\n\t\tType 1 to Continue ; Type 0 to Exit --> "); scanf("%d",&x); switch(x) { case 1: printf("\n\n\t\tEnter the Year : "); scanf("%d",&year); if((year>9999)||(year<0)) { clrscr(); printf("\n\n\n\n\n\n\n\t\t\t\t INPUT ERROR !\n\n\t\tThe program doesnot allow poly-digital year input !\n\n\n\t\t Press any key to try again......"); getch(); break; } if(year%100==0) { if(year%400==0) printf("\n\n\t\tThe year %d is a leap year.",year); else printf("\n\n\t\tThe year %d is not a leap year.",year); } else { if(year%4==0) printf("\n\n\t\tThe year %d is a leap year.",year); else printf("\n\n\t\tThe year %d is not a leap year.",year); } printf("\n\n\n\t\tPress any key to continue......"); getch(); break; case 0: clrscr(); printf("\n\n\n\n\n\n\n\n\n\t\t\t\tPROGRAM TERMINATED !\n\n\t\t Press any key to return to source file......"); getch(); break; default:clrscr(); printf("\n\n\n\n\n\n\n\n\n\t\t\t\tINVALID INPUT !\n\n\t\t\tPress any key to try again......"); getch(); break; } } }