CJCoding With Joseph

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
Topics:
Functions
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.