Write VB script to test given number is Prime Number

Answer Posted / kishore

Dim n
count=0
n=inputbox("enter a number")
For i=2 to n-1
If n mod i=0Then
count=count+1
End If

Next
If count>3 Then
print "given numer is normal number"
else
print "given number is prime number"
End If

Is This Answer Correct ?    31 Yes 37 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is there anyway to automatically update the Datasource name in Database Checkpoints object when we migrate tests to a new release?

3271


what is the hierarchy to use properties in descriptive programming

1496


If I give some thousand tests to execute in two days what do you do?

580


How qtp recognizes the object?

667


How many types of parameters are there?

543






What are the different types of recording modes in qtp? Which will be used when?

561


How do I get the QTP scripts result in xml format by using vb script function?

1780


I want two test two agents login for the flight website. Here is the scenario: I want to go through 1-3 rows for one user login and other user login I want to go though 3-5 rows. How would you set this up in qtp. Thank You

1520


Explain in brief about the qtp automation object model (aom).

559


How to do the scripting. Are there any inbuilt functions in QTP? What is the difference between them? How to handle script issues?

572


what is the difference between development and testing

2370


How often were they executed?

2034


How do Parameterization and Data-Driving relate to each other in QTP?

553


What are the different types of functions available in qtp and explain ?

562


I am a newbie to QTP / Automation testing. I want to develop a script that creates a data file automatically with proper headings using VBScript in QTP.

1579