#include <iostream>
using std::endl;
using std::cout;
using std::cin;
int main()
{
long long i=0, j=0,k=0,m=0;
cout << "which primary number you want to get .? " << endl;
cin >> k;
bool isPrime = false;
cout << "Prime Number : " << endl;
for(i = 2 ; i<= 999999 ; i++)
{
for(j = 2; j <= 999999 ; j++)
{
if(i != j && 0 == i % j)
{
isPrime = false;
break;
}else
{
isPrime = true;
}
}
if(isPrime == true)
{
if(m!=k){
m++;
cout << "(" << m << ") " << i << endl;
}
}
}
cout << endl;
system("pause");
return 0;
}
Copy and Paste then Run :)