Skip to content

Instantly share code, notes, and snippets.

@GZShi
Created October 9, 2012 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GZShi/3857116 to your computer and use it in GitHub Desktop.
Save GZShi/3857116 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#define TRUE 1
#define FALSE 0
int judge(int year)
{
if(year % 4 != 0)
return FALSE;
else if(year % 100 == 0)
{
if(year % 400 == 0)
return TRUE;
else
return FALSE;
}
else
return TRUE;
}
int main(void)
{
int year = 0;
char *s[2] = {"NO", "YES"};
scanf("%d", &year);
printf("%s\n", s[judge(year)]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment