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

ReneRene
Change my mind. I dare you.
Chat with Rene
ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach

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