For one of my school projects I have to make a function that can basically list the prime numbers of the total set of numbers you insert.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include<iostream>
#include<cmath>
#include<string> //I know I don't need all these libraries.
#include<time.h>
#include<cstdlib>
#include<ctype.h>
usingnamespace std;
int listPrimesNumbers(int a)
{
// Don't know how to do this function
}
int main()
{
listPrimeNumbers(20); // any number set within here
return 0;
}
How would I figure out if the numbers within 1 to 20 for example are prime numbers? Any help is appreciated. Thanks.