Challenge 24

📖

Number Facts

Open in Code Editor or Copy Instructions
...solutions at bottom of page...

Create a procedure that takes in a number as a parameter and outputs facts about it

Examples:

numberFacts(9) returns 9 is odd, a square number and not prime

numberFacts(2) returns 2 is even and prime

The facts and specific format you output is up to you

Extension:

Ensure your program can identify the following facts: positive/negative, even/odd, is integer, is square, is cube, is prime

Solutions

IGCSE 0478 / O-Level 2210 A-Level 9618