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.
42-1st-piscine/ended/C05/ex06/ft_is_prime.c
2023-08-06 20:12:38 +02:00

28 lines
1.0 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_prime.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ajoly <ajoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/28 10:27:29 by ajoly #+# #+# */
/* Updated: 2022/08/01 15:58:00 by ajoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_prime(int nb)
{
int i;
i = 2;
if (nb <= 1)
return (0);
while (i <= nb / i)
{
if (nb % i == 0)
return (0);
i++;
}
return (1);
}