Check if a Number Is Prime
hardQuestion 260Write a function bool isPrime(int n) that returns true when n is a prime number (a whole number greater than 1 whose only divisors are 1 and itself), and false otherwise.
The program prints true or false. For isPrime(13) it prints true.
Expected output
true= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Functions
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.