C Program to Check Year is a Leap Year or Not

Year is a Leap Year or Not

In this program we have to find the year is a leap year or not. Generally  we assume that year is exactly divisible by 4 is a leap year. But it is not only in this case 1900 is divisible by 4. But it  is not a leap so it that case we follows these conditions   

  • It is exactly divisible by 100
  • If it is divisible by 100, then it should also exactly divisible by 4
  • And it is divisible by 400  

These all conditions are true then year is a leap year.


  • Step 1. Initialize variable “year” to find leap year.
  • Step 2. Take input from User.
  • Step 3. We use this condition ((year%4==0)&&(year%100!=0)) || (year%400==0)) to check the year is Leap or not.
  • Step 4. If the condition is true then, display year is a leap year.
  • Step 5. It the condition is false, then display year is not a leap year.
  • Step 6. Stop.

C Code

void main()
//Declare variable year
int year;

//Ask user to enter year
printf("Enter a year: ");

//store year in year variable
scanf("%d", &year);

if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0))
printf("%d is a leap year", year);

printf("%d is not a leap year", year);



Enter a year: 2000
2000 is a leap year