#include <stdio.h>
int ft_sqrt(int nb)
{
int x;
int y;
if (nb < 0)
return (0);
x = nb;
y = (x + 1) / 2;
while (y < x)
{
x = y;
y = (x + nb / x) / 2;
}
if (x * x == nb)
return (x);
else
return (y);
}
int ft_is_prime(int nb)
{
int sq;
int i;
sq = ft_sqrt(nb);
i = 2;
while (i <= sq)
{
if (nb % i == 0)
return (0);
i++;
}
return (1);
}
int ft_find_next_prime(int nb)
{
while (ft_is_prime(nb) == 0)
nb++;
return (nb);
}
int main(){
int result = ft_find_next_prime(33);
printf("%d", result);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: