first commit
This commit is contained in:
20
ended/C05/ex03/ft_recursive_power.c
Normal file
20
ended/C05/ex03/ft_recursive_power.c
Normal file
@ -0,0 +1,20 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_recursive_power.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: ajoly <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/27 18:32:22 by ajoly #+# #+# */
|
||||
/* Updated: 2022/07/27 18:51:35 by ajoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_recursive_power(int nb, int power)
|
||||
{
|
||||
if (power < 0)
|
||||
return (0);
|
||||
else if (power == 0)
|
||||
return (1);
|
||||
return (nb * ft_recursive_power(nb, power - 1));
|
||||
}
|
Reference in New Issue
Block a user