Skip to content

Instantly share code, notes, and snippets.

@ilake
Created November 8, 2015 15:45
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 ilake/9c6653aef013a44c5d96 to your computer and use it in GitHub Desktop.
Save ilake/9c6653aef013a44c5d96 to your computer and use it in GitHub Desktop.
#include "stdio.h"
bool leap_year(int y) {
int is_leap;
is_leap = (y % 400 == 0) ||
((y % 4 == 0) && !(y % 100 == 0));
return is_leap;
}
int main(void) {
if (leap_year(2016)) {
printf("2016 is leap year");
}
else {
printf("2016 is not leap year");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment