Skip to content
Home » Leap Year Program in C Using if-else statement

Leap Year Program in C Using if-else statement

Learn about Leap Year Program in C Using if-else statement in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Leap Year Program in C Using if-else statement

Program:

#include<stdio.h>
int main()
{
  int year;

  printf("Enter Year: ");
  scanf("%d",&year);

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

  return 0;
}

Output:

Enter Year: 2024
2024 is a leap year.

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C Program to Check Vowel or Consonant using predefined function
Check Character is Vowel or Consonant using Switch case