Advertisement
neogz

prost broj

Feb 10th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5.  
  6. int main()
  7. {
  8.  
  9.     int n,en=0;
  10.     cout << "Unesi neki prirodan broj n: ";
  11.     cin >> n;
  12.  
  13.     for (int i = 2; i < n; i++)
  14.     {
  15.         if (n%i == 0) en++;
  16.     }
  17.  
  18.     if (en != 0)cout << "Broj nije prost" << endl;
  19.     else cout << "Broj je prost." << endl;
  20.  
  21.    
  22.     system("pause >null");
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement