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 / ravi salunkhe

val=Inputbox("enter any number")
valprime=0
For i=2 to sqr(val)
If (val mod i)=0 Then
msgbox "not a prime number"
valprime=1
Exit for
End If
Next
If valprime=0 Then
msgbox "prime number"
End If

this will chop off the looping by limiting the loop to the
square root of the number!...\M/...mosh!

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain about operator precedence in vb script?

1057


How to declare an array in vbscript?

1312


What if you do not specify anything when you call a procedure?

1122


Illustrate briefly about the different types of statement

2493


Explain the operator precedence in vb script?

1059


What are the different types of operators and their order of precedence?

1038


what is used of Property........End Property loop ? how to write the script for it?

2246


What is the difference between a dictionary and an array?

1054


How will you compare two strings in vbscript?

1059


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

1024


Which keyword is used to declare a variable in the vbscript language?

939


why do u choose to go for testing why cant for devoloping

2060


How to find the font in qtp. Scenario:After entering the username and passwd you will be navigate into the "welcome:Username" page.Now I want to extarct font for this message.

2135


how to operate webobjects in a webpage using getobject function and then using generic methods?

3093


How to make professional test report using vbscript code in UFT, which gives us complete analysis of the test.

2964