Last active
September 8, 2015 20:56
-
-
Save MadCoder/8ad551feecab07dc8097 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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