/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_iterative_power.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: gtertysh +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/10/29 14:35:08 by gtertysh #+# #+# */ /* Updated: 2016/10/29 14:56:28 by gtertysh ### ########.fr */ /* */ /* ************************************************************************** */ int ft_iterative_power(int nb, int power) { int result; if (power < 0) { return (0); } else if (power == 0) { return (1); } result = nb; while (power > 1) { result *= nb; power--; } return (result); }