1
0

first commit

This commit is contained in:
Adam Joly
2023-08-03 23:16:27 +02:00
parent 7f3254f1c5
commit a80c4d61d7
133 changed files with 4293 additions and 0 deletions

BIN
C05/ex06/.ft_is_prime.c.swp Normal file

Binary file not shown.

29
C05/ex06/ft_is_prime.c Normal file
View File

@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_prime.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/23 23:24:05 by adjoly #+# #+# */
/* Updated: 2023/08/02 10:20:17 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_prime(int nb)
{
int i;
if (nb <= 0 || nb == 1)
return (0);
i = 2;
if (nb == 2)
return (1);
while (i < nb / 2)
{
if (nb % i == 0)
return (0);
i++;
}
return (1);
}