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
what is used of Property........End Property loop ? how to write the script for it?
when we use filter funtiom invb script(QTP)
Hi this is Vinoth. I need a help on below mentioned question A combobox contains list of items assume as 5 I have to get each items Individually and I have to Export to datatable. Please help me on this. Thanks
Explain vbscript in detail?
In the Web page we have a table link, if we click on that link all the contents under that link will be sorted (asscending/Descending). Now i want to check in which order the list is ? for that i need to get the data in to some var How can i get that cells data?
How to capture a runtime error in vbscript?
Description.Create
Which date function is used in the vbscript language to find the difference between the 2 dates?
Explain the operator precedence in vb script?
Mention how to create a cookie using vbscript?
I am working on QTP, got struck in one place.. In my application depending upon configuration WebEdit count is increasing/ decreasing.. how to get these webedits..
Explain the extension .hta?
What's the difference between vbscript and vb.net?
Which operator can be used to change the value of the operand or change the state of the condition?
How to make sure that items in a wintree are sorted al?