-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_sqrt.c
27 lines (25 loc) · 1.05 KB
/
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
24
25
26
27
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sqrt.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: istalevs <istalevs@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/10/24 18:39:49 by istalevs #+# #+# */
/* Updated: 2017/12/10 18:23:50 by istalevs ### ########.fr */
/* */
/* ************************************************************************** */
int ft_sqrt(int nb)
{
int i;
i = 1;
if (nb == 0 && nb <= 2147395600)
return (nb);
while (nb >= i)
{
if (nb / i == i && nb % i == 0)
return (i);
i++;
}
return (0);
}