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
How will you compare two strings in vbscript?
Which date function is used in the vbscript language to find the difference between the 2 dates?
Explain about scrrun.dll in vbscript?
Compare java script and vb script?
How to create a cookie using vbscript?
What are subprocedures in vbscript?
Which event is triggered when mouse focus comes out of an element in the vbscript language?
What is the use of the formatdatetime function in the vbscript language?
How will you get the natural logarithm of the given number in vbscript?
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
What is the use of the recordset object and which statement is used to create such an object?
What is the difference between a dictionary and an array?
Please let me Know regarding any material regarding VB Scripting which should be easily understandable for Beginners.
Both Static and dynamic arrays are handled by VB script. Is it true?
Mention the rules for using option explicit statement?