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 / bhanu jay singh

<html>
<head>
<script language="vbscript" for="b1" event="onclick">
a=document.form.t1.value
for c=2 to a-1
if(a mod c)=0 then
x="no"
exit for
else
x="yes"
end if
next
if x="no" then
document.write("not a prime")
else
document.write("prime")
end if
</script>
</head>
<body>
<form name="form">
<input type="text" name="t1">
<input type="button" name="b1" value="find">
</form>
</body>
</html>

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we create Crystal Report object in QTP?If yes then what it is and what are its various properties?

3407


What is vbscript language used for and which earlier language is it modeled upon?

947


Explain about .wsf files?

1056


What are the rules to name variable in vbscript?

1016


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

900


Which object provide information about a single runtime error in a vbscript?

1010


Which in-built function is used to format the number in the vbscript language?

948


why variable name should not exceed 255 characters?

2167


Explain the scope of the variables using dim, public, and private keywords respectively.

1099


Why is the use of exit do or exit for statements within loops discouraged?

980


What are string functions in vbscript?

1092


What is the technology used by vb script?

915


what types of bugs will we find out in banking projects for automation testing?

2165


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

914


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

1098