42_C_PISCINE/C/c05v2/ex05/ft_sqrt.c
Camille Chauvet 29ed24d567 init
2023-05-17 16:45:25 +00:00

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);
}