CJCoding With Joseph
15free / daySign inCreate account

Check if a Number Is Prime

Write 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 — print one after the last line.

Hints4 available
Topics:
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.