/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_iterative_factorial.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: whaffman +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/13 10:52:17 by whaffman #+# #+# */ /* Updated: 2024/06/13 11:06:44 by whaffman ### ########.fr */ /* */ /* ************************************************************************** */ #include int ft_iterative_factorial(int nb) { int result; result = 1; if (nb >= 0) { while (nb > 1) result *= nb--; return (result); } return (0); } #ifdef DEBUG int main(void) { int i; i = -3; while (i < 10) { printf("%d! = %d\n", i, ft_iterative_factorial(i)); i++; } return (0); } #endif