fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int x = 21;
  7. for (int y = 2; y < x; y++) {
  8. cout << y << endl;
  9. if (x % y == 0) {
  10. cout << "Not a prime." << endl;
  11. break;
  12. }
  13. }
  14.  
  15. return 0;
  16.  
  17. }
Success #stdin #stdout 0s 4544KB
stdin
Standard input is empty
stdout
2
3
Not a prime.