#include <stdio.h>

int ft_is_prime(int nb)
{
    int i;
    i = 2;
    if (nb < i)
        return (0);
    while (i < nb / i)
    {
        if (nb % i == 0)
            return (0);

        i++;
    }
    return 1;
}
int ft_find_next_prime(int nb)
{
    if (nb <= 2)
        return (2);
    if (ft_is_prime(nb))
    {
        return (nb);
    } else {
        return ft_find_next_prime(nb + 1);
    }
}
int main() {
    printf("%d\n", ft_find_next_prime(7));
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: