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
what is the object hyrarchy in QTP for a web based application
Explain the asc function?
How to add actions in driver script to run those actions in QTP?
Which function is used in the vbscript language to convert the specified expression into a date type value?
what is resorceallocation
Which event is triggered when mouse focus comes out of an element in the vbscript language?
How to get the length of the string by making use of the string function?
while using Keyward driven framework in QTPif new requirements are added how to manage it...plz ans
What is purpose of scripting.filesystemobject class in vbscript?
What are the properties of regexp object?
Compare java script and vb script?
How to capture a runtime error in vbscript?
How will you get a string with the specified character the specified number of times in vbscript?
What are class properties?
What are class variables?