1
0
This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.

29 lines
1.1 KiB
C
Raw Permalink Normal View History

2023-08-06 20:12:38 +02:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sqrt.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ajoly <ajoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/27 21:41:03 by ajoly #+# #+# */
/* Updated: 2022/08/01 15:57:14 by ajoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_sqrt(int nb)
{
int i;
i = 1;
while (i * i < nb && i <= nb / 2)
i++;
if ((nb % i) == 0)
return (i);
return (0);
}
#include <stdio.h>
int main()
{
printf("%d", ft_sqrt(__INT_MAX__));
}