Last active
October 15, 2018 15:34
-
-
Save kalimalrazif/8f5c18ccb38a72ede819 to your computer and use it in GitHub Desktop.
Ejemplo de Recursividad, factorial
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> | |
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