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
Which operator can be used to do an xor operation in vbscript?
If else for do while select in vb script?
Explain sga memory structures?
can anyone send me a vb scripts code for clicking on a link and coming back on home page again does the same for many links on a web page.
write a program to display configuration of a local system with the help of vb script.
What is the use of option explicit statement?
how to set one column as primary key in QTP and fetch values accordingly
What are the different types of operators and their order of precedence?
Can automation testing find ssame no. of bugs what we can find by manual testing?
how to acces the remote mechine using vb cript(QTP)
Explain few date functions in vbscript?
how to operate webobjects in a webpage using getobject function and then using generic methods?
How to Convert Hex color code to color name in VB Script?
What are the special sub-types in vbscript?
What are events in the vbscript language?