0
0
This commit is contained in:
2021-08-17 19:59:45 +02:00
parent 6e576f39ca
commit 42df274074
10 changed files with 197 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_prime.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <gbaconni@student.42lausan> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/17 17:09:01 by gbaconni #+# #+# */
/* Updated: 2021/08/17 18:28:10 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_prime(int nb)
{
int r;
int i;
if (nb == 0 || nb == 1)
r = 0;
else
r = 1;
i = 2;
while (r > 0 && i < nb)
r &= (nb % i++ != 0);
return (r);
}