How can I generate sieres of prime number using function in C++?

  1. profile image46
    yosiyasposted 6 years ago

    How can I generate sieres of prime number using function in C++?

    #include
    #include
    bool isprime (int num);
    int main()
    {

    int num=0;
    int i=0;

    printf("Enter numbers > ");
    scanf("%d", &num);

    while (i

  2. dipless profile image82
    diplessposted 6 years ago

    Please find below some code which will create a list of primes up to a user dfined number. Hope this Helps. (sorry can't fit enough of the code here)

    #include
    using namespace std;
    void prime_num(int);
    int main()
    {
    cout > num;
    prime_num(num);
    }

    void prime_num( int num)
    {
            bool isPrime=true;
            for ( int i = 2; i

 
working