I'm new to the whole programming stuff. If anyone can help me on this that would be awesome.
I have to create a program that will tell me how many primes numbers there are between 1 and N. The max value is 50,000 and I have to use 2 void functions
What I have so far is
#include <iostream>
using namespace std;
-I know I have to insert void function here-
int main ()
{
char reply = 'y';
while (reply =='y' || reply == 'Y')
{
cout << Continue?";
cin>> reply;
}
return 0;
}
-void functions-
Like for example my output would be:
"The amout of prime numbers between 1 and N is: -value-"
(The amount of prime numbers 1 and 10 is: 5)
Thank you in advanced to all that helps me on this :)
void prime_num(int N) //int N will be inputted by user
{
int count=0;
for(int i=2;i<=N;i++)
{
if(N%i!=0)
{
count++;
continue;
}
}
cout<<"The number of prime between 1 and "<<N<<" are: "<<count;
}
I have to
1. Create a void function to get the user input
2. Create a function to find the number of prime numbers from 1 max_number
3. Create a function to load primes into an array
4. Create a void function to output the values to the screen using this array