Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- bool CheckIsPrime(int UserValue) {
- int check = 0;
- for (int i = 2; i = (UserValue - 1); i++) {
- if (UserValue % i)
- continue;
- else
- return false;
- }
- return true;
- }
- int main(){
- int UserValue = 0;
- std::cout << "Enter a number: ";
- std::cin >> UserValue;
- std::cout << "\nThe number: " << UserValue;
- UserValue = CheckIsPrime(UserValue);
- if (UserValue)
- std::cout << " is Prime";
- else
- std::cout << " is not Prime";
- }
Add Comment
Please, Sign In to add comment