/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_sqrt.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: gbrochar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/12/07 08:28:11 by gbrochar #+# #+# */ /* Updated: 2015/12/07 08:50:43 by gbrochar ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" long ft_sqrt(long n) { long sqrt; sqrt = 0; while ((sqrt * sqrt) != n && (sqrt * sqrt) < n) sqrt++; return (((sqrt * sqrt) == n) ? (sqrt) : (-1)); }