Please look at the following and see if you could advise.
cout << \"2\" << endl;
cout << \"3\" << endl;
ofstream of(\"Primes.txt\");
here is the most simplest logic:
//Prime Numbers generation in C++
//Using for loops and conditional structures
#include
using namespace std;
int main()
{
int a = 2; //start from 2
long long int b = 1000; //ends at 1000
for (int i = a; i <= b; i++)
{
for (int j = 2; j <= i; j++)
{
if (!(i%j)&&(i!=j)) //Condition for not prime
{
break;
}
if (j==i) //condition for Prime Numbers
{
cout << i << endl;
}
}
}
}