Created
March 7, 2017 16:19
-
-
Save squirrel532/c8986a8dfdbea2343abec8a61dcf6ef7 to your computer and use it in GitHub Desktop.
This file contains 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
#include <stdio.h> | |
/* | |
This function, rec will prints all number between va and vb | |
in diminishing order. | |
rec(1, 5) and rec(5, 1) give same output. | |
*/ | |
int rec(int va, int vb) { | |
(va > vb) && printf("%d\n", va); | |
(vb >= va) && printf("%d\n", vb); | |
return va != vb && rec(va - (va>vb), vb - (vb > va)); | |
} | |
int main(int argc, char const* argv[]) | |
{ | |
rec(5, 1); | |
rec(1, 5); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment