VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Accepts a number and checks if it is prime or not.

by Ankita Jain (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 3rd October 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Accepts a number and checks if it is prime or not.

Rate Accepts a number and checks if it is prime or not.



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

Download this snippet    Add to My Saved Code

Accepts a number and checks if it is prime or not. Comments

No comments have been posted about Accepts a number and checks if it is prime or not.. Why not be the first to post a comment about Accepts a number and checks if it is prime or not..

Post your comment

Subject:
Message:
0/1000 characters