Created
July 2, 2018 18:53
-
-
Save sojohnnysaid/32672039c02dd322f36ee29330f6e9ce to your computer and use it in GitHub Desktop.
simple recursion
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> | |
int recursive(int number); | |
int main(void){ | |
printf("%i\n", recursive(5)); | |
return 0; | |
} | |
int recursive(int number){ | |
if(number <= 1) | |
return 1; | |
else | |
return number + recursive(number - 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment