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 / sayali

Dim prime, n

prime = TRUE

n=cint(inputbox("Enter a number to find whether it is Prime or Not"))

for i=2 to (n-1)

If n mod i = 0 then
prime = False

Exit for
End if
Next

If prime then
msgbox "Yes! It is a Prime number"
Else
msgbox "No! it is not a prime number"
End if

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the operator precedence in vb script?

1142


can anyone send me a vb scripts code for clicking on a link and coming back on home page again does the same for many links on a web page.

2359


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

2464


how to increase the values in text box in a given text box increament by two values by clicking on button

2255


What are the advantages of vbscript?

1142


How to open excel in vb script?

1076


What are the uses of vb script?

1094


where can i learn VB scripint ?

2164


What are the valid scopes of a variable in vbscript?

1150


How to throw an error in vbscript?

1200


How are comments handled in the vbscript language?

1054


What is vbscript procedures?

1196


Explain the functionality of vbscript?

1010


Explain some uses of vb script?

1015


Explain what is loose binding? Why is it not a good practice to use it?

1135