Program to check if year is leap year

Program to check if year is leap year 


We know a leap year is year which has 29 days in February.
Leap year occurs after every 4 years.
To find leap year we divide year by 4.
If reminder comes out as 0 then we say that it is Leap year.

Program:


#include<stdio.h>
void main()
{
int yr;
printf("Enter year: ");
scanf("%d",&yr);
if(yr%4==0)
{
printf("Leap Year");
}
else
{
printf("Not Leap Year");
}
}

Output:






No comments:

Post a Comment