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 (iPlease 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

Related Discussions

- 4
### How can I generate series of prime number using functions on C++?

by yosiyas6 years ago

How can I generate series of prime number using functions on C++?here is my code so far:#include #include bool isprime (int num);int main(){int num=0;int i=0;printf("Enter numbers >...

- 3
### Is there a pattern to the sequential distribution of prime numbers?

by stanwshura5 years ago

Is there a pattern to the sequential distribution of prime numbers?3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53...The space between is, in order : 2, 2, 4, 2, ...

- 2
### How much could MR.T bench press in his prime and the present day now?

by David 4707 years ago

How much could MR.T bench press in his prime and the present day now?

Copyright © 2018 HubPages Inc. and respective owners.

Other product and company names shown may be trademarks of their respective owners.

HubPages^{®} is a registered Service Mark of HubPages, Inc.

HubPages and Hubbers (authors) may earn revenue on this page based on affiliate relationships and advertisements with partners including Amazon, Google, and others.

terms of use privacy policy (0.56 sec)

working