Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
C Program to Check Leap Year
SUBMITTED BY:
kaushal1981
DATE:
Feb. 21, 2017, 9:14 p.m.
FORMAT:
Text only
SIZE:
574 Bytes
Raw
Download
Tweet
HITS:
863
Go to comments
Report
#include <stdio.h>
int main()
{
int year;
printf("Enter a year: ");
scanf("%d",&year);
if(year%4 == 0)
{
if( year%100 == 0)
{
// year is divisible by 400, hence the year is a leap year
if ( year%400 == 0)
printf("%d is a leap year.", year);
else
printf("%d is not a leap year.", year);
}
else
printf("%d is a leap year.", year );
}
else
printf("%d is not a leap year.", year);
return 0;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus