21 lines
1.0 KiB
C
21 lines
1.0 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_recursive_power.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/07/19 17:28:20 by cchauvet #+# #+# */
|
|
/* Updated: 2022/07/27 17:42:57 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
int ft_recursive_power(int nb, int power)
|
|
{
|
|
if (power < 0)
|
|
return (0);
|
|
if (power == 0)
|
|
return (1);
|
|
return (ft_recursive_power(nb, power - 1) * nb);
|
|
}
|