26 lines
1014 B
C
26 lines
1014 B
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_sqrt.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/07/25 17:33:47 by cchauvet #+# #+# */
|
|
/* Updated: 2022/07/25 17:35:41 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
int ft_sqrt(int nb)
|
|
{
|
|
int i;
|
|
|
|
i = 1;
|
|
while (i <= nb / i)
|
|
{
|
|
if (i * i == nb)
|
|
return (i);
|
|
i++;
|
|
}
|
|
return (0);
|
|
}
|