Skip to content

Instantly share code, notes, and snippets.

@kalimalrazif
Last active October 15, 2018 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kalimalrazif/8f5c18ccb38a72ede819 to your computer and use it in GitHub Desktop.
Save kalimalrazif/8f5c18ccb38a72ede819 to your computer and use it in GitHub Desktop.
Ejemplo de Recursividad, factorial
#include <stdio.h>
double factorial(int);
int main(){
int numero = 5;
double total;
total = factorial(numero);
printf("El factorial de %d es %d\n", numero, total);
return 0;
}
double factorial(int nro){
if(nro<=0) return 1;
return nro * factorial(nro - 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment