-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_sqrt.c
27 lines (24 loc) · 1.02 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: jsprouts <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/09/25 19:16:52 by jsprouts #+# #+# */
/* Updated: 2019/09/25 19:17:33 by jsprouts ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_sqrt(int nb)
{
int x;
x = 1;
while ((x * x) <= nb)
{
if ((x * x) == nb)
return (x);
x++;
}
return (0);
}