Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int main()
- {bool prost;
- int n, i, broj, brojac=0;
- cin>>n;
- broj=n;
- do
- {for (i=2; i<broj; i++)
- {if (broj%i==0) prost=false;
- if (broj%i!=0) {prost=true; brojac++;}
- }
- broj++;
- }
- while(brojac!=(broj-2));
- cout <<"Prvi prost broj veći od n je "<<broj-1<<endl;
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement