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

How will you compare two strings in vbscript?

1001


Which date function is used in the vbscript language to find the difference between the 2 dates?

1010


Explain about scrrun.dll in vbscript?

1039


Compare java script and vb script?

1028


How to create a cookie using vbscript?

1123


What are subprocedures in vbscript?

1059


Which event is triggered when mouse focus comes out of an element in the vbscript language?

907


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

957


How will you get the natural logarithm of the given number in vbscript?

987


Hi All, I am facing one problem in QTP. There is link object in my application that exist in the Frame in mozilla firefox. Click event on that object is not working but once the frame is enabled/activated then click event works fine.But the frame does not have the activate property. This problem is coming in firefox only. Regards

2651


What is the use of the recordset object and which statement is used to create such an object?

917


What is the difference between a dictionary and an array?

997


Please let me Know regarding any material regarding VB Scripting which should be easily understandable for Beginners.

1979


Both Static and dynamic arrays are handled by VB script. Is it true?

1036


Mention the rules for using option explicit statement?

929