Advertisement
theo830

prime

Apr 28th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. int isPrime(int n) {
  2. int i;
  3. if(n == 2) return 1;
  4. if(n%2 == 0) return 0;
  5. for(i = 3; i*i<=n; i+=2) {
  6. if(n%i == 0) return 0;
  7. }
  8. return 1;
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement