1
0
This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
42-1st-piscine/ended/C05/ex03/ft_recursive_power.c

21 lines
1.0 KiB
C
Raw Normal View History

2023-08-06 20:12:38 +02:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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));
}