Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How to Import data from a file (file is on the desktop) to the data table

2001


Explain the constants in vbscript?

932


How are comments handled in the vbscript language?

946


hi all, i had a question, that how to find out hiding a coloumn in a table i had a table having the following column names NAME DESCRIPTION CREATED TIME CREATED USER if i right clicked on a NAME column it will displays a menu having the same column names in a list like NAME DESCRIPTION CREATED TIME CREATED USER with check boxes.if i unched any check box, that column name should not be appear in the main table column names could anyone please solve this problem?

1945


Explain sga memory structures?

966


Which operator can be used to do an xor operation in vbscript?

1180


What is the purpose of the err object in the vbscript language?

1036


What is variant in vb script?

1089


How are arrays declared in the vbscript language?

941


Explain about scrrun.dll?

895


when we use filter funtiom invb script(QTP)

2729


Which function allows you to instantiate an object given its programmatic identifier or progid?

979


what is the standards used for writing the script in QTP

2271


wat is the com(common object model)object for mozilla firefox???????plz if any one know the exact answer....reply me......

1836


How to use QTP Object in .vbs(vbscript file) file Ex: Browser().., wait(), exist() and etc...

3380