Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool isPrime(int num)
- {
- int i;
- bool ans;
- i=2;
- while(i < num)
- {
- if(num%i == 0)
- {
- ans = false;
- //cout<<"\nisPrime? false";
- break;
- }
- i++;
- }
- if(i == num)
- {
- //cout<<"\nisPrime? true";
- ans = true;
- }
- return ans;
- }
Add Comment
Please, Sign In to add comment