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 / pankaj
Function IsPrime(Num)
Dim varNum, varCtr, varLimit
varLimit = Round(Num/2)
For varCtr = 2 To varLimit
varNum = Num Mod varCtr
If varNum = 0 Then
IsPrime = False
Exit For
End If
Next
If varCtr >= varLimit Then
IsPrime = True
End If
End Function
MsgBox IsPrime(19)
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
How to Import data from a file (file is on the desktop) to the data table
Explain the constants in vbscript?
How are comments handled in the vbscript language?
hi all, i had a question, that how to find out hiding a coloumn in a table i had a table having the following column names NAME DESCRIPTION CREATED TIME CREATED USER if i right clicked on a NAME column it will displays a menu having the same column names in a list like NAME DESCRIPTION CREATED TIME CREATED USER with check boxes.if i unched any check box, that column name should not be appear in the main table column names could anyone please solve this problem?
Explain sga memory structures?
Which operator can be used to do an xor operation in vbscript?
What is the purpose of the err object in the vbscript language?
What is variant in vb script?
How are arrays declared in the vbscript language?
Explain about scrrun.dll?
when we use filter funtiom invb script(QTP)
Which function allows you to instantiate an object given its programmatic identifier or progid?
what is the standards used for writing the script in QTP
wat is the com(common object model)object for mozilla firefox???????plz if any one know the exact answer....reply me......
How to use QTP Object in .vbs(vbscript file) file Ex: Browser().., wait(), exist() and etc...