- Joined
- Jun 14, 2021
- Messages
- 6
- Reaction score
- 0
I wish to write a function that determines if a number is prime (1) or not (0). The only rule I know to apply is to write them in the form of 6n + 1.
Code:
int is_prime(int nb)
{
int i;
i = 2;
while (i < nb)
{
i++;
}
if (nb % nb == 0) // Prime
return (1);
return (0);
}