Could Anybody tell me VBScript for
Check if a given number is Prime number-Don't use any Built-
in Functions Boolean/int is Prime(int number).. Thanks in
advance.

Answer Posted / mudaseer

vnum=inputbox("enter the number")
for i=2 to vnum-1
if(vnum mod i)=0 then
vf="no"
exit for
else vf="yes"
end if
next
if vf="no" then
msgbox "not a prime"
else
msgbox "it is a prime"
end if

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to increase the values in text box in a given text box increament by two values by clicking on button

1645


how to write codings in QTP using vb script. please help me. i am new to QTP. it is easy or very much tough. please tell me

12896


What are the special sub-types in vbscript?

554


Why to use option explicit in vb script?

600


Hi this is Vinoth. I need a help on below mentioned question A combobox contains list of items assume as 5 I have to get each items Individually and I have to Export to datatable. Please help me on this. Thanks

1724






hi Set myobj=Description.Create() myobj("type").value="submit" myobj("name").value="google search" myobj("html tag").value="button" browser("title:=google").page("title:=google").webButton (myobj).Click i was running above code in one weak back it was working fine i got result,again i opened after few days ,again i was trying to run the code it shows run time error in last line of my code ,why ?pls answer my question?

1740


Write a test case using Test if the images,a particular test exists,check if the page links match,page response is within a certain range,parameterization of the test,the test should comprise of actions,the test should use a custom function,the test should use global repository

1794


Mention what is the main difference between function and sub-procedure?

551


Hi All, I am facing one problem in QTP. There is link object in my application that exist in the Frame in mozilla firefox. Click event on that object is not working but once the frame is enabled/activated then click event works fine.But the frame does not have the activate property. This problem is coming in firefox only. Regards

2261


how to increasing the numbers in a given text box please write a vb script

1705


How to replace junk code recorded by QTP with a mall function.

1646


What is the difference between a dictionary and an array?

583


What are events in the vbscript language?

552


Hellow friends, I am learning QTP,but here problem is VB script. please guide me how to learn VB script w.r.t QTP and if you know any books tell me or if you have any materials or any use full material or any else w.r.t QTP please post me p.p.sekhar

1966


I have an excel sheet with multiple ID's in a column. Now i need fetch those ID's in an application and check whether if it already exist in the DB. If not then i have to go with the process of inserting them in the DB. If it exists then i need to skip that ID and move to the next ID and check the same and proceed. How can i do that with for loop and if condition?

862