Leap year or Not?

Program 3: Program to find Leap Year or Not

problem statement:

The question is to write a program to check whether the given year is leap year or not. we need to analyze the problem statement and need to derive the possible solutions.In this case we need to check whether the year is leap year or not

Analysis

Condition for leap year:

 /*
 Experiment: Given year is leap year or not
 */
 void main()
 {
 int year;
 clrscr();
 printf("\nEnter a year");
 scanf("%d", &year);
 if ((year % 400) == 0)
 printf("\n%d is a leap year", year);
 else if ((year % 100) == 0)
 printf("\n%d is a not leap year", year);
 else if ((year % 4) == 0)
 printf("\n%d is a leap year", year);
 else
 printf("\n%d is not a leap year", year);
 getch();
 }