Input a year and check if it's a leap year C Program

How to write a c program to input a year and check if it's a leap year in C Programming Language ?


Solution:
//Program to input a year and check if it's a leap year.
#include<stdio.h>
#include<conio.h>

void main()
{
int year;

clrscr();

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

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

getch();
}


Learn More :