0
0
This commit is contained in:
Guy Baconniere
2021-08-20 10:02:38 +02:00
parent 5aa02c94b5
commit d30270c485
354 changed files with 0 additions and 0 deletions

26
C_05/git/ex05/ft_sqrt.c Normal file
View File

@@ -0,0 +1,26 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sqrt.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <gbaconni@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/18 10:53:01 by gbaconni #+# #+# */
/* Updated: 2021/08/18 12:08:49 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
int ft_sqrt(int nb)
{
int i;
if (nb == 2147483647)
return (0);
i = 1;
while (nb > 0 && i < 46341 && i * i < nb)
i++;
if (nb / i == i && nb % i == 0)
return (i);
else
return (0);
}