Hi, Anybody could you Please tell me How to write the
script for Checking whether given number is Prime Number or
not..Thanks in Advance

Answer Posted / nisar

Dim i,num
num=CInt(InputBox("Enter the numbers to limit the
Prime:"))
i = 3
While i <= num
bIsPrime = True
j = 2
While j <= i\2 And bIsPrime
bIsPrime = i Mod j > 0
j = j + 1
Wend
If bIsPrime Then
Wscript.echo("Found a prime number: " & i)
End If
i = i + 2
Wend

Is This Answer Correct ?    0 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

wat is the com(common object model)object for mozilla firefox???????plz if any one know the exact answer....reply me......

1489


Explain about the extension .hta?

621


What are the special sub-types in vbscript?

546


create a form to accept username and password validate the username and password with using message box, display the corresponding user message

2159


What is the use of the ‘open’ method to work with the database in the vbscript language and what connection string is passed in the same and what is its usage?

487






Which conditional statement is the most convenient one to use in the case of multiple conditions in the vbscript language?

520


Which operator is used to perform the comparison among 2 operands in the vbscript language?

524


What are the uses of vb script?

585


Which object is used to work with the excel sheets in the vbscript language and what statement is used to create this object?

481


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

509


Differentiate javascript and vbscript?

567


In html file what is an ideal position to include vbscript?

808


Mention how to assign a date value to a variable?

585


What is loose binding? Why is it not a good practice to use it?

631


how to check whether link is disabled in QTP??

5629