Advertisement
Tavxela

Untitled

Dec 21st, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool isPrime(int a) {
  6. if (a % 2 == 0 || a % 3 == 0 || a % 5 == 0) {
  7. return false;
  8. }
  9. else {
  10. return true;
  11. }
  12. }
  13.  
  14. int main() {
  15. int input;
  16. cout << "Enter number: ";
  17. cin >> input;
  18.  
  19. if (isPrime(input)) {
  20. cout << input << " is prime" << endl;
  21. }
  22. else {
  23. cout << input << " isn't prime" << endl;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement