Guest User

Untitled

a guest
Feb 14th, 2020
72
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int i,n,gasit,ok,d;
  4. int main()
  5. {
  6. cin>>n;
  7. gasit=0;
  8. d=n+1;
  9. while(gasit==0)
  10. {
  11. ok=1;
  12. if(d<2)
  13. ok=0;
  14. else
  15. {
  16. for(i=2; i*i<=d; i++)
  17. if(d%i==0)
  18. {
  19. ok=0;
  20. break;
  21. }
  22.  
  23. if(ok==1)
  24. {
  25. cout<<d;
  26. gasit=1;
  27.  
  28. }
  29. else d++;
  30.  
  31. }
  32. }
  33. return 0;
  34. }
RAW Paste Data