-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_sqrt.c
23 lines (21 loc) · 1007 Bytes
/
ft_sqrt.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sqrt.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: schaaban <schaaban@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/12/07 17:39:21 by schaaban #+# #+# */
/* Updated: 2017/12/07 22:02:45 by schaaban ### ########.fr */
/* */
/* ************************************************************************** */
int ft_sqrt(int nb)
{
long i;
i = 0;
if (nb < 0)
return (0);
while (i * i < nb)
i++;
return ((int)i);
}