Dark mode logo
Last Updated:
Find if a year is leap year or not

C Program to check if a year is leap year or not

Algorithm

Input: Input a year
output: Check if a year is leap year or not

  1. Start
  2. Input a numbers say year
  3. if year % 400 == 0
    3.1 Print The year is leap year
  4. else if year % 100 == 0
    4.1 Print The year is not leap year
  5. else if year % 4 == 0
    5.1 Print The year is leap year
  6. else 
    6.1 Print The year is not leap year
  7. stop

C Program

#include<stdio.h>
int main( )
{
int year;
printf("Enter a year to check if its leap year or not: ");
scanf("%d", &year);
if (year % 400 == 0) {
    printf("%d is a leap year.", year);
    }
else if (year % 100 == 0) {
           printf("%d is not a leap year.", year);
           }
else if (year % 4 == 0) {
           printf("%d is a leap year.", year);
           }
else {
        printf("%d is not a leap year.", year);
        }
return 0;
}



Note: This Program was created using visual studio code. The Program file can be downloaded by clicking here

 

 

Comments