answersLogoWhite

0


Best Answer

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
This answer is:
User Avatar
User Avatar

Anonymous

Lvl 1
3y ago
Thanks

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
Related questions

How do you find out how many digits are in integer using vbscript?

num=32767 MsgBox(len(num))


How do you find the prime number of 6 using a tree diagram?

6 2,3


How do find factorial using vbscript?

<html> <script language="vbscript"> n=cint(inputbox("Enter a number")) dim f f=1 if n<0 then Msgbox "Invalid number" elseif n=0 or n=1 then MsgBox "The factorial of given number "&n&" is :"&f else for i=n to 2 step -1 f=f*i next MsgBox "The factorial of given number "&n&" is :"&f end if </script> </html>


How do you find a fraction of a prime number?

Divide the prime number.


How do you find the least prime number?

2 is the least prime number.


Find the prime number next to 23456787565?

The previous prime number is 23,456,787,559 and the next prime number is 23,456,787,593.


Write each number as the product of prime using exponents 405?

I assume you mean to find the prime factorization of 405. If so: 34 x 5


How do you find prime number?

Prime numbers are the numbers that can only be divided by 1 and them selves. As in 13 if you were to factor it using only whole numbers you would see that its factors are only 1 and 13. There for it is prime. While 12 you see that the factors are 1,2,3,4,6,12 meaning that it is not prime.You test several numbers, to see whether they are prime numbers, until you find a prime number.


How do you find the 12th prime number using c?

To keep it simple: Write a main loop that goes through all the numbers, starting with 2, and incrementing one at a time. Determine whether each number is a prime number. If it is, increment a counter. To determine whether each number is a prime number, either use an inner loop, or a separate function. Test divisibility of the number "n" by every number from 2 to n-1. If you find a factor, then it is not a prime number. Note that you can test divisibility by using the "%" operator. For example: if (number % factor == 0) // number is divisible by factor else // it isn't


What is the prime numbers for 374?

To find the prime factors of any number then divide the number by prime numbers of increasing value. When a prime number wholly divides the original number repeat the process with the same prime number but each time with the new quotient until complete division does not occur. Repeat with a prime number of higher value until the final quotient is 1. Using this process gives the prime factors of 374 as 2, 11 and 17.


What is a prime number and how do to find them?

13 is a prime number because u cant find 13 as a product on a multiplication!


How do you solve a prime number?

to answer a prime number you must find a number that goes into it and that divides by itself :)