i wrote this program to find prime numbers, but whenever i run it, i get an error.
This is the code [c++]:
My real task is to get the user to input a number greater than 2, and then print out what prime numbers added together would make up the number the user inputed. For example:
4 = 2 + 2
6 = 3 + 3
8 = 3 + 5
10 = 3 + 7 etc.
i need to create a function: void Goldbach(int n, int& p1, int & p2)
and the main program would be:
int num, prime1, prime2;
cout<<"Enter an even positive integer greater than 2:";
cout<<num<<" = "<<prime1<<" + "<<prime2<<endl;
//my first step is to determine what 2 prime numbers would add up to get the //number the user inputs.