Write VB script to test given number is Prime Number

Answer Posted / prasanth

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>1 Then
print "given numer is normal number"
else
print "given number is prime number"
End If

Is This Answer Correct ?    8 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the benefits of qtp?

550


I want to capture data(using keyword) from msdos application using QTP?... Below is little work i could do on it... /* Set app=CreateObject("Wscript.shell") SystemUtil.run ("C:\Users\Agent\Desktop\pumpsim\PUMPSIM.EXE") Window(“PUMPSIM.EXE”).Activate wait(3) app.sendkeys "N" */ Thanks in advance...!!!

1435


How to associate shared object repository to test in qtp?

503


how u will evaluate the tool for test automation?

1368


whenever U using QTP,Test Director, Why we using separate Bug tracking tool?

1562






whare exactly we have to use functions and sub routain

1842


if numbers are always changing write a script for that

3388


How do we handle run-time errors?

575


Hi there, I've installed a trial version of QTP to see if it works with my product but I cant automate selecting windows from a tree view? Can anyone give me any pointers? Many Thanks

1412


In QTP TEST DIRECTOR COMBINATION WHAT IS THE PURPOSE OF TEST DIRECTOR? In Somebody says to store test cases and design test cases.?ok fine , but In test director 5.0 , QTp not launching. what u do?

1488


How to capture a window in QTP?

1524


hi guys we r working in office...we write some scripts..suddenly we have a work(5min only) in out side..what will do now,,,used to system shut down or log off or lock or sleep mode,switch use or hibernate?

1584


How many add-ins comes by default with qtp?

537


Which environments are supported by hp qtp?

596


what is the difference between modular framework & datadriven framework

1593