C Program to Check Leap Year

The following is a C Program to Check Leap Year on screen after taking input from the user. Let's get started.

C Program To Check Leap Year
C Program To Check Leap Year

Overview:


Commands

scanf() function is used to obtain input and printf() function is used to print the string on the screen.
if() statement is used as test function.

Program

#include<stdio.h>
#include<conio.h>
void main()
{
     int year;
     clrscr();
     printf("Enter any year\n");
     scanf("%d",&year);
     if(year%400==0||year%4==0)
  printf("%d is a leap year.\n", year);
     else
  printf("%d is not a leap year.\n",year);
     getch();
}



Output

Leap Year Output
Leap Year Output

All programs compiled in this post are compiled in AnDOSBox.

Books I Prefer:






I hope this article was helpful to understand C Program to Check Leap Year! Comment below, if you've got any question. Head back soon for another interesting article on C Programming.