Skip to content

Instantly share code, notes, and snippets.

@sojohnnysaid
Created July 2, 2018 18:53
Show Gist options
  • Save sojohnnysaid/32672039c02dd322f36ee29330f6e9ce to your computer and use it in GitHub Desktop.
Save sojohnnysaid/32672039c02dd322f36ee29330f6e9ce to your computer and use it in GitHub Desktop.
simple recursion
#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