Created
December 16, 2014 04:13
-
-
Save scratchyourbrain/62a4cf787f058e47de8e to your computer and use it in GitHub Desktop.
C Program to Check Leap Year
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int year; | |
printf("Enter a year: "); | |
scanf("%d",&year); | |
if(year%4 == 0) | |
{ | |
if( year%100 == 0) /* Checking for a century 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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment