42_C_PISCINE/C/c05v2/ex06/ft_is_prime.c

26 lines
1019 B
C
Raw Normal View History

2023-05-17 12:45:25 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_prime.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/20 13:40:46 by cchauvet #+# #+# */
/* Updated: 2022/07/27 16:51:04 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_prime(int nb)
{
int i;
i = 2;
while (i <= nb / i)
{
if (nbr % i == 0)
return (0);
i++;
}
return (1);
}