Skip to content

Instantly share code, notes, and snippets.

@milon
Created January 19, 2018 01:52
Show Gist options
  • Save milon/a4c66e9b4ee58b14e7e0cc6fa09cf6b1 to your computer and use it in GitHub Desktop.
Save milon/a4c66e9b4ee58b14e7e0cc6fa09cf6b1 to your computer and use it in GitHub Desktop.
Prime Number
//Prime number check
//Author: Milon
bool isPrime(int num){
if(num==1)
return false;
if(num==2)
return true;
if(num%2==0)
return false;
for(int i=3;i*i<=num;i+=2)
if(num%i==0)
return false;
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment