PRIME Command

The PRIME command (TCL), checks for an inputted number being a prime number and requests for and generates the next lowest or highest prime number when the inputted number is not a prime number.

Format

PRIME {num}

The num parameter is optional and if it is not specified, the PRIME command prompts the user for it. The num value specifies the number to be checked for a prime number.

If the num value is a prime number, a message is displayed indicating that the number is a prime number.

If the num value isn’t a prime number, the PRIME command prompts the user if either the next lowest or next highest prime number should be generated. If the user requests for a prime number to be generated, the PRIME command generates it and displays a message containing the generated prime number.

After the PRIME command completes processing of the entered num value, it prompts the user again for another num value. Either the user can enter another num value or press Enter to stop processing and return to TCL.