Advertisement
Josif_tepe

Untitled

Feb 15th, 2021
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int n;
  6.     cin >> n;
  7.     for(int i = 2; i < n; i++) {
  8.         if(n % i == 0) {
  9.             cout << "NOT PRIME" << endl;
  10.             return 0; // the program will end
  11.         }
  12.     }
  13.     cout << "PRIME" << endl;
  14.     return 0;
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement