Hi, Anybody could you Please tell me How to write the
script for Checking whether given number is Prime Number or
not..Thanks in Advance

Answer Posted / pankaj jaju

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

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Mention what is byref and byval parameters in vbscript?

577


How to pass argument by reference to a function in vbscript?

536


1. How do declare public variable in vb scripts?

1577


Which object provide information about a single runtime error in a vbscript?

599


Explain the adodb.stream class?

545






Explain about constants in vb script?

571


i am having some basic knowledge in c and VB 6.0. i qtp i want to know how to write the codings. by recording it is generating lot of codings. for example i want to test the text box. senerio is text box should not accept alphabets if it accept alphabets we should return fail status if it get number we should return pass status. how to write coding in vb script please help me

1795


how to increasing the numbers in a given text box please write a vb script

1698


How many types of operators are available in the vbscript language?

535


hi Set myobj=Description.Create() myobj("type").value="submit" myobj("name").value="google search" myobj("html tag").value="button" browser("title:=google").page("title:=google").webButton (myobj).Click i was running above code in one weak back it was working fine i got result,again i opened after few days ,again i was trying to run the code it shows run time error in last line of my code ,why ?pls answer my question?

1733


Mention what if you do not specify anything when you call a procedure?

570


How can you fetch the value of a cookie?

548


Explain a few date functions in vbscript

556


There are 5 web pages.write a script to click the button on 4th web page.

2938


Which function is used to perform string comparison?

559