C Program to check whether the current year is a leap year or not | C Programming

C Program to check whether the current year is a leap year or not

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


Output

Leap Year Output

Leap Year Output

Comments

Popular posts from this blog

C Program for SCAN Disk Scheduling Algorithm | C Programming

C program to Find Cartesian Product of Two Sets | C programming

C Program To Check The String Is Valid Identifier Or Not | C Programming