24 lines
1 KiB
C
24 lines
1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_recursive_factorial.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/10/29 12:29:58 by gtertysh #+# #+# */
|
|
/* Updated: 2016/10/29 14:34:23 by gtertysh ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
int ft_recursive_factorial(int nb)
|
|
{
|
|
if (nb < 0 || nb > 12)
|
|
{
|
|
return (0);
|
|
}
|
|
else if (nb >= 1 && nb <= 12)
|
|
{
|
|
return (nb *= ft_recursive_factorial(nb - 1));
|
|
}
|
|
return (1);
|
|
}
|