A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Prime Number in Rexx page! Here, you'll find the source code for this program as well as a description of how the program works.
/* ARG with source string named in REXX program invocation */
arg number
If (DATATYPE(number, 'W') == 0) then signal err
If (number < 0) then signal err
isPrime = 1
if \((number // 2 = 0) & (number \= 2) | (number == 1)) then
do
i = TRUNC(number / 2)
do while(i > 3)
if (number // i == 0) then
isPrime = 0
i = i - 1
end
end
else
isPrime = 0
if (isPrime == 1) then
say "Prime"
else
say "Composite"
;exit
Err:
say 'Usage: please input a non-negative integer'; exit
Prime Number in Rexx was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.