Advertisement
Guest User

Untitled

a guest
Dec 17th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {bool prost;
  7. int n, i, broj, brojac=0;
  8. cin>>n;
  9. broj=n;
  10. do
  11. {for (i=2; i<broj; i++)
  12. {if (broj%i==0) prost=false;
  13. if (broj%i!=0) {prost=true; brojac++;}
  14. }
  15. broj++;
  16. }
  17. while(brojac!=(broj-2));
  18. cout <<"Prvi prost broj veći od n je "<<broj-1<<endl;
  19. system("PAUSE");
  20. return EXIT_SUCCESS;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement