Archived
first commit
This commit is contained in:
1 parent
1fe062c970
commit
eb6b113e51
125 files changed
+2987
No files matched your search
@@ -0,0 +1,29 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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__));
|
||||
}
|
||||
Reference in new issue
Block a user