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

What methods are used to create text files and open text files in the vbscript language?

538


What are events in the vbscript language?

552


Plzzzzzzz can any one tell me which is the best institute in hyderabad for learing VBScript. plz do answer guys its urgent plzzzzzzz. thanks in advance.

1729


Can automation testing find ssame no. of bugs what we can find by manual testing?

1474


What is the purpose of drive object of scripting.filesystemobject class in vbscript?

610






Explain about scrrun.dll in vbscript?

655


How to scroll down a page while recording in qtp. suggest me any method apart from low level recording.

2583


how to write a vb script in QTP for yahoo registration form, i want to check the performance also like performance test, stress, load test like that.

4751


How are values assigned to the variables in the vbscript language?

579


How will you convert a string to lower case string using vbscript?

561


What is the difference between vbscript and vba?

608


What are string functions in vbscript?

658


Mention how to create a cookie using vbscript?

535


Which constant is used for print and display functions and works as same as pressing enter key?

532


Is vbscript a case-sensitive or case-insensitive?

755