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 should i Create Email invite with server-side Coding?
What is the output of a + b in vbscript if a = 5 and b = 10?
Can someone please tell me what poor design in a relational database (not the layout or style) is and how it can be avoided? PLEASE...im desperate.
How can you create an object in vbscript?
How will you get the smallest subscript of an array in vbscript?
What is the use of the formatdatetime function in the vbscript language?
How to open a file. What is the perpose of true and false mode there?
how to operate webobjects in a webpage using getobject function and then using generic methods?
How to access array data?
How to create a function in vbscript?
What are the naming conventions while declaring a variable in the vbscript language?
Hi Friends my Question is very simple,in Manual testing when we click on a hyper link it directs us to the relavent page or it re-directs us to the current page,so there we can easily write testcase but same thing if we do in automation script using QTP & need to generate report using Reporter.report event how we will do it?thanks in advance...
Hi anyone Can Send Solution to the Question wt m posting now Prepare Script for the Bellow Scenario? Login to Gmail Page Open Inbox check Mails save them in a Folder
while using Keyward driven framework in QTPif new requirements are added how to manage it...plz ans
does anyone have qtp11.0 license key.Please sendit to my mail id-rrvv2011@gmail.com...Thanks