24 lines
1.0 KiB
C
24 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/08/01 18:09:47 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
int ft_recursive_factorial(int nb)
|
||
|
{
|
||
|
if (nb < 0)
|
||
|
return (0);
|
||
|
if (nb == 0)
|
||
|
return (1);
|
||
|
if (nb == 1)
|
||
|
return (nb);
|
||
|
else
|
||
|
return (nb * ft_recursive_factorial(nb - 1));
|
||
|
}
|