-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_next_sqrt.c
35 lines (33 loc) · 1.12 KB
/
ft_next_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
28
29
30
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_next_sqrt.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: itiievsk <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/02 13:24:52 by itiievsk #+# #+# */
/* Updated: 2018/04/02 13:24:55 by itiievsk ### ########.fr */
/* */
/* ************************************************************************** */
int ft_next_sqrt(int num)
{
int s;
int temp;
int result;
result = 0;
temp = num;
while (result == 0)
{
s = 1;
while (s * s < temp)
{
s++;
if (s * s == temp)
result = s;
else
result = 0;
}
temp++;
}
return (result);
}