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
Can we create Crystal Report object in QTP?If yes then what it is and what are its various properties?
What is vbscript language used for and which earlier language is it modeled upon?
Explain about .wsf files?
What are the rules to name variable in vbscript?
Difference between dim,public and private variables in vb script?
Which object provide information about a single runtime error in a vbscript?
Which in-built function is used to format the number in the vbscript language?
why variable name should not exceed 255 characters?
Explain the scope of the variables using dim, public, and private keywords respectively.
Why is the use of exit do or exit for statements within loops discouraged?
What are string functions in vbscript?
What is the technology used by vb script?
what types of bugs will we find out in banking projects for automation testing?
What is the use of the recordset object and which statement is used to create such an object?
How will you get the largest subscript of an array in vbscript?