Last active
June 6, 2019 02:24
-
-
Save donpandix/94b330b08b914dd61e6d42ea00e282d7 to your computer and use it in GitHub Desktop.
Cálculo del valor factorial
This file contains hidden or 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
/** | |
* Clase para el cálculo del valor Factoral (n!) | |
* de un número entero usando recursividad | |
*/ | |
class Factorial { | |
/** | |
* Cálculo el valor factorial (n!) | |
* llamada al método | |
* | |
* int retorno = Factorial.calculo(3) | |
* | |
* retorno asumirá el valor: 6 | |
*/ | |
public static int calculo (int numero) { | |
if (numero <= 1) return 1; | |
return numero * Factorial.calculo(numero - 1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment