How to find if given number is prime or not



How to find if given number is prime or not..

Answer / vishnu

flag = 1

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
flag = 0
Exit for
End if
Next

If flag = 1 then
msgbox "Yes! It is a Prime number"
Else
msgbox "No! it is not a prime number"
End if

Is This Answer Correct ?    8 Yes 0 No

Post New Answer

More QTP Interview Questions

what is the difference between rational rose and QTP? WHICH TOOL IS BETTER TO LEARN? PLEASE SEND ME AT sana_50218@yahoo.com sandeep@epuratech.com

0 Answers   EpuraTech,


How do u insert an object during runtime in qtp?

2 Answers  


write qtp descriptive programming to activate multiple notepads? please urgent friends

1 Answers   TCS,


How to add synchronisation points in qtp?

0 Answers  


what is frame work?

2 Answers   Wipro,






What are the methods of the TextStream object that are used for reading from a text file?

0 Answers  


how to automate standalone infopath forms using QTP? (it is not a dotnet or a web form)

1 Answers   ABC,


write a script to validate the content in the web application. (do it by OR method) and (do it by Descriptive method by creating a description object.. (give a filter condition only WEbelement- not easy need to use some more property while giving filter condtions- use google for your help...))

0 Answers  


hai friends i'm learning qtp now where we r using only record &playback frame work.and people r saying in realtime they won't use this frame work. if so what frame work actually using in realtime .and could you give explanation comaparing the record &play back fm and what ever FWyou r using in your organization. hoping cool response. thanx in advance

3 Answers  


diff between global variables and environment variables in qtp?

1 Answers   FIS,


what is automation(qtp)bug pls giv me one ex?

1 Answers  


Explain QTP Testing process ?

13 Answers   TCS,


Categories