#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 = ft_sqrt(nb);
    int i = 2;

    while (i <= sq)
    {
        if(nb % i == 0)
            return 0;
        else
            return 1;
        i++;
    }
}


int main() 
{
    int a = ft_is_prime(33);
    printf("%d", a);
    return 0;
}

Embed on website

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