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

What is the difference between for loop and while loop?

1073


Explain sga memory structures?

1037


I have an excel sheet with multiple ID's in a column. Now i need fetch those ID's in an application and check whether if it already exist in the DB. If not then i have to go with the process of inserting them in the DB. If it exists then i need to skip that ID and move to the next ID and check the same and proceed. How can i do that with for loop and if condition?

1402


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

3417


What are the differences between sub procedures and function procedures?

993


How to add actions in driver script to run those actions in QTP?

1948


How should i Create Email invite with server-side Coding?

2141


What are keywords in the vbscript language?

1039


How can the spaces from the string be removed?

1021


Which respective symbols are used to separate a line and to break the lengthy statement into multiple statements in the vbscript language?

1305


while using Keyward driven framework in QTPif new requirements are added how to manage it...plz ans

2070


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

3119


Explain the .wsf files?

975


about vb scripting programs this type of all question& answers

2142


when we use filter funtiom invb script(QTP)

2793