answersLogoWhite

0

Dim prime, n

prime = TRUE

n=cint(inputbox("Enter a number to find whether it is Prime or Not"))

for i=2 to (n-1)

If n mod i = 0 then

prime = False

Exit for

End if

Next

If prime then

msgbox "Yes! It is a Prime number"

Else

msgbox "No! it is not a prime number"

End if

User Avatar

Wiki User

14y ago

Still curious? Ask our experts.

Chat with our AI personalities

JudyJudy
Simplicity is my specialty.
Chat with Judy
ReneRene
Change my mind. I dare you.
Chat with Rene
BeauBeau
You're doing better than you think!
Chat with Beau

Add your answer:

Earn +20 pts
Q: How can find prime number by using if in vbscript?
Write your answer...
Submit
Still have questions?
magnify glass
imp