sync
This commit is contained in:
14
C_Piscine_C_05/git/ex02/ft_iterative_power.c
Normal file
14
C_Piscine_C_05/git/ex02/ft_iterative_power.c
Normal file
@@ -0,0 +1,14 @@
|
||||
int ft_iterative_power(int nb, int power)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (power < 0)
|
||||
n = 0;
|
||||
else if (power == 0)
|
||||
n = 1;
|
||||
else
|
||||
n = nb;
|
||||
while (power > 0 && --power)
|
||||
n *= nb;
|
||||
return (n);
|
||||
}
|
||||
Reference in New Issue
Block a user