ajout sqartroot
This commit is contained in:
3
Makefile
3
Makefile
@@ -106,7 +106,8 @@ SRCS = ft_memset.c \
|
|||||||
ft_abs.c \
|
ft_abs.c \
|
||||||
ft_greater.c \
|
ft_greater.c \
|
||||||
ft_smaller.c \
|
ft_smaller.c \
|
||||||
ft_sign.c
|
ft_sign.c \
|
||||||
|
ft_sqrt.c
|
||||||
|
|
||||||
|
|
||||||
ODIR = ./builds
|
ODIR = ./builds
|
||||||
|
|||||||
@@ -108,5 +108,6 @@ int ft_abs(int n);
|
|||||||
int ft_greater(int a, int b);
|
int ft_greater(int a, int b);
|
||||||
int ft_smaller(int a, int b);
|
int ft_smaller(int a, int b);
|
||||||
int ft_sign(int i);
|
int ft_sign(int i);
|
||||||
|
int ft_sqrt(int i);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
15
srcs/ft_sqrt.c
Normal file
15
srcs/ft_sqrt.c
Normal 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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user