Created
January 19, 2018 01:52
-
-
Save milon/39fc5ec3aa1bd1b32384f8d39864ca5e to your computer and use it in GitHub Desktop.
Prime Number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Prime number check | |
| //Author: Milon | |
| bool isPrime(int num){ | |
| if(num<2) | |
| return false; | |
| if(num==2) | |
| return true; | |
| if(num%2==0) | |
| return false; | |
| for(int i=3;i<num/2;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