Created
April 25, 2020 18:05
-
-
Save domiyanyue/080fa067e4d99baae45b10cab13ddbb8 to your computer and use it in GitHub Desktop.
mutual recursion
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(int n); | |
bool is_odd(int n); | |
bool is_even(int n) { | |
if (n == 0) | |
return true; | |
else | |
return is_odd(n - 1); | |
} | |
bool is_odd(int n) { | |
if (n == 0) | |
return false; | |
else | |
return is_even(n - 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment