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

if u ve resrevation for train and u get a number supose 1234xxxokie.after sucessul entering all required fields. now u put that number in search and want to chk wether these ar same or not if both ar same then its okie otherwise test fail.what would be the vb script code for it to compare these two values of different page.

1807


Why to use option explicit in vb script?

1015


Explain the functionality of vbscript?

896


How can you fetch the value of a cookie?

981


We have 1 web page with names column. I am giving the Service Providers1,2,3.... @ that time dynamically some no of names are displaying in the webpage and The Pop up windows are opening(No.of Pop Up windows=No.of Names). The names may be diffar for each and every Service Provders (Dynamically) How can we handle the Dynamic values?

2147


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

1856


Mention how you can call vbscript functions?

1062


Explain the adodb.stream class?

950


what is resorceallocation

2170


How will you get a string with the specified character the specified number of times in vbscript?

977


Explain How do you create a recordset object in vbscript?

980


What are the 2 ways to pass a value to the function?

901


what is the use of QCUtil? explain with one example?

6978


What is the use of the instr function?

1010


please can you help me to get a code of flames using a visual basic 6

1735