ajout sqartroot

This commit is contained in:
hugogogo
2021-07-25 12:49:58 +02:00
parent 60ebf29333
commit 1f234c4e58
3 changed files with 18 additions and 1 deletions

View File

@@ -106,7 +106,8 @@ SRCS = ft_memset.c \
ft_abs.c \
ft_greater.c \
ft_smaller.c \
ft_sign.c
ft_sign.c \
ft_sqrt.c
ODIR = ./builds

View File

@@ -108,5 +108,6 @@ int ft_abs(int n);
int ft_greater(int a, int b);
int ft_smaller(int a, int b);
int ft_sign(int i);
int ft_sqrt(int i);
#endif

15
srcs/ft_sqrt.c Normal file
View File

@@ -0,0 +1,15 @@
#include "libft.h"
/*
** return the square root of nb
** or the integer value of it
*/
int ft_sqrt(int nb)
{
int i;
i = 0;
while ((i*i) < nb)
i++;
return (i);
}