This commit is contained in:
Camille Chauvet
2023-05-17 16:45:25 +00:00
commit 29ed24d567
619 changed files with 16119 additions and 0 deletions

BIN
Correction/sam/ex03/a.out Executable file

Binary file not shown.

View File

@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_recursive_power.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/19 17:28:20 by cchauvet #+# #+# */
/* Updated: 2022/08/01 15:04:30 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);
}
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
if (argc > 2)
printf("%d", ft_recursive_power(atoi(argv[1]), atoi(argv[2])));
}