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/ex04/a.out Executable file

Binary file not shown.

View File

@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_fibonacci.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/20 10:23:01 by cchauvet #+# #+# */
/* Updated: 2022/08/01 15:07:40 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_fibonacci(int index)
{
if (index == 0)
return (0);
if (index == 1)
return (1);
if (index < 0)
return (-1);
return (ft_fibonacci(index - 1) + ft_fibonacci(index - 2));
}
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv)
{
if (argc > 1)
printf("%d", ft_fibonacci(atoi(argv[1])));
}