22 lines
1.0 KiB
C
22 lines
1.0 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_recursive_factorial.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2022/07/19 17:06:51 by cchauvet #+# #+# */
|
||
|
/* Updated: 2022/07/25 17:29:21 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
int ft_recursive_factoriel(int nb)
|
||
|
{
|
||
|
if (nb < 0)
|
||
|
return (0);
|
||
|
if (nb == 1)
|
||
|
return (nb);
|
||
|
else
|
||
|
return (nb * ft_recursive_factoriel(nb - 1));
|
||
|
}
|