Advertisement
BowserFlash13

asd

May 15th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6.  
  7.  
  8. int main() {
  9.  
  10.     int x;
  11.     bool f=true;
  12.  
  13.     cin >> x;
  14.  
  15.     for (int i = x-1; i > 1; i--) {
  16.         if (x % i == 0){
  17.             f = false;
  18.         }
  19.     }
  20.     if (f == true){
  21.         cout <<"Broj je prost"<< endl;
  22.     }
  23.     else {
  24.         cout << "Broj nije prost"<< endl;
  25.     }
  26.         system("pause");
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement