Leap year program


Prev Tutorial Next Tutorial

Program to check leap year

A leap year is a year containing one additional day that means in leap year 366 day. and leap year are divisible by 4 so if you write any program to check leap year check year must be divisible by 4.

Program to check leap year

#include<stdio.h>
#include<conio.h>

 void main()
 {
 int y;
 printf("Enter any year: ");
 scanf("%d",&y);
if(y%4==0)
{
printf("Leap year");
}
else
{
printf("Not a leap year");
}
getch();
}

Output

Enter any year: 2004
Leap year

Prev Tutorial Next Tutorial

Advertisements




Facebook Likes

Advertisements