1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include <iostream> #include <cmath> using std::cout; // http://stackoverflow.com/q/14574823/849891 using std::endl; // minimal edit to fix your code using std::cin; // marked by //*// int main(){ int x,i,j; cout << "Please enter an integer 'x' greater than 3: " << endl; cin >> x; if (x <= 3){ cout << "Please enter new value 'x' greater than 3: " << endl; cin >> x; } for(int i=3; i<=x; i++){ for(j=2; j<i; j++){ if(i%j == 0) break; } //*// add } // else //*// add // if(i == j) // +1); //*// add ) // cout << i << endl; // } //*// add // } return 0; } |