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/26 16:55:09 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
int ft_recursive_factorial(int nb)
|
||
|
{
|
||
|
if (nb < 0)
|
||
|
return (0);
|
||
|
if (nb == 1)
|
||
|
return (nb);
|
||
|
else
|
||
|
return (nb * ft_recursive_factorial(nb - 1));
|
||
|
}
|