Could Anybody tell me VBScript for
Check if a given number is Prime number-Don't use any Built-
in Functions Boolean/int is Prime(int number).. Thanks in
advance.
Answer Posted / sayali
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
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
Explain the operator precedence in vb script?
can anyone send me a vb scripts code for clicking on a link and coming back on home page again does the same for many links on a web page.
what is the object hyrarchy in QTP for a web based application
how to increase the values in text box in a given text box increament by two values by clicking on button
What are the advantages of vbscript?
How to open excel in vb script?
What are the uses of vb script?
where can i learn VB scripint ?
What are the valid scopes of a variable in vbscript?
How to throw an error in vbscript?
How are comments handled in the vbscript language?
What is vbscript procedures?
Explain the functionality of vbscript?
Explain some uses of vb script?
Explain what is loose binding? Why is it not a good practice to use it?