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 do until loop and do while loop?

1029


create a form to accept username and password validate the username and password with using message box, display the corresponding user message

2598


How will you get the smallest subscript of an array in vbscript?

1326


Which command is used for writing text on a page?

943


Why is it recommended to close the database connection every time after the work is completed?

894


How can the spaces from the string be removed?

979


what is the standards used for writing the script in QTP

2285


What are the environments supported by vbscript language?

885


If a calulator having 3 buttons (of any number)in 3 of them one is not working properly due to which answer is wrong always. write a script to find out which button is not working properly ?

1992


What are the uses of vb script?

1001


What is Procedure or Subroutine in VB Script?

1091


Mention what is select case statement?

920


How will you get the last occurrence of one string within another string using vbscript?

1147


what is resorceallocation

2169


how to automatically update the sql server2005 database records when insert in vb6?

1900