Skip to content

Instantly share code, notes, and snippets.

@MadCoder
Last active September 8, 2015 20:56
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 MadCoder/8ad551feecab07dc8097 to your computer and use it in GitHub Desktop.
Save MadCoder/8ad551feecab07dc8097 to your computer and use it in GitHub Desktop.
bool is_even(unsigned n)
{
char buf[11];
sprintf(buf, "%10u", n);
switch (buf[9]) {
case '0': return true;
case '1': return false;
default: return is_even(buf[9]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment