Accepts a number and checks if it is prime or not.
Accepts a number and checks if it is prime or not.
Rate Accepts a number and checks if it is prime or not.
(2(2 Vote))
j=0
for i=1 to x
if x mod i =0 then
j=j+1
endif
next i
if j=2 then
print"Prime"
elseif j<>2 then
print"Composite"
elseif x=1 then
print "Neither Prime nor composite"
endif
Accepts a number and checks if it is prime or not. Comments
No comments yet — be the first to post one!
Post a Comment