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 is sql loader? Explain the files used by sql loader to load file?

898


Illustrate briefly about the different types of statement

2269


How can you create a file object to work with the files in the vbscript language?

740


How to write functions and sub in vb script?

849


how to write codings in QTP using vb script. please help me. i am new to QTP. it is easy or very much tough. please tell me

13586


Mention how to create a cookie using vbscript?

776


How do you declare a variable in vbscript?

867


Anyone have qtp11.0 crack?

2625


What are the different types of loops available in the vbscript language?

760


How you can call vbscript functions?

823


what is the object hyrarchy in QTP for a web based application

2136


What are the valid scopes of a variable in vbscript?

854


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

805


Explain sga memory structures?

825


Which function is used to perform string comparison?

837