Write VB script to test given number is Prime Number

Answer Posted / apoorva

bresult = False
Num = 907
For i = 2 To Num / 2
If Num Mod i = 0 Then
bresult = True
Exit For
End If

Next
If bresult = True Then
MsgBox "Prime"
Else
MsgBox "Not Prime"
End If

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of Object Repository?

590


1. What is the difference between Keyword and function in the keyword driven framework? 2. How do you associate Keywords to the script ?

989


How can we extract data like "Details","Result","Time" from the 'Run Error' result generated in QTP after run time errors are generated during a run & import the details etc...into excel sheet

1538


How to save your test using quicktest professional (qtp)?

600


How can you write the scripts that operate on different objects depending on run-time information?

2122






How would you export a script from one pc to another in qtp?

663


Is it possible to call win runner script in qtp?

627


Can any one tell me about "Mapping Repository Parameter Values" and why we use it....??How to use it???Please, tell the preconditions also...........???? Thanks in Advance

1503


Object repositories types, which and when to use?

579


What r the different filters in defect in quality center

3285


What is the use of an object spy tool in qtp?

559


Why do you create a text checkpoint on a Web application? What is the purpose of the Close method?

1359


if our qtp vb Script may be Currepted then What we want do?

1487


Is it possible to change the property value at runtime? How it is possible?

575


Explain the concept of object repository and how quicktest professional recognises objects?

560