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 are the differences between sub procedures and function procedures?

1035


Give me sm ideas to write Vbscripts abt protocol testing abilash700@gmail.com.

2140


Which constant is used for print and display functions and works as same as pressing enter key?

1046


Mention what is byref and byval parameters in vbscript?

1052


How to open a file. What is the perpose of true and false mode there?

1166


How to open excel in vb script?

1076


How will you check that a variable is an array in vbscript?

1053


What is the use of the formatdatetime function in the vbscript language?

1076


What is the main difference between function and sub-procedure?

1108


How will you reverse a string in vbscript?

1215


Can automation testing find ssame no. of bugs what we can find by manual testing?

2025


Dear All, I am geting below IE error whilie executing the QTP scripts in Batch mode "Internet Explorer has encountered a problem and needs to close. We are sorry for the inconvenience." can any one suggest me how to resolve this issue . Thanks Balaji

1770


how to answer "TELL ME ABOUT UR SELF" as exp.person. whr to start and whr to stop. can anyone tel me

1893


Difference between dim,public and private variables in vb script?

1000


who will create the object?

2252