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 / ravi salunkhe
val=Inputbox("enter any number")
valprime=0
For i=2 to sqr(val)
If (val mod i)=0 Then
msgbox "not a prime number"
valprime=1
Exit for
End If
Next
If valprime=0 Then
msgbox "prime number"
End If
this will chop off the looping by limiting the loop to the
square root of the number!...\M/...mosh!
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Explain sga memory structures?
Can automation testing find ssame no. of bugs what we can find by manual testing?
How will you get the natural logarithm of the given number in vbscript?
What is the use of the ‘open’ method to work with the database in the vbscript language and what connection string is passed in the same and what is its usage?
How to Convert Hex color code to color name in VB Script?
what is the use of QCUtil? explain with one example?
What are the data types supported by vbscript?
PLz send me the VB scripts which is having more examples my email id : hareen_11@yahoo.com
What is vbscript language used for and which earlier language is it modeled upon?
What are keywords in the vbscript language?
I want to run QTP script on Linux server is it possible to do this by connecting Windows to Linux through VPN/Terminal Server and just run the script on Linux server.
Mention what is variant in vbscript?
How are values assigned to the variables in the vbscript language?
What is vbscript procedures?
how to write a vb script in QTP for yahoo registration form, i want to check the performance also like performance test, stress, load test like that.