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.
Answers were Sorted based on User's Feedback
Answer / pankaj
Function IsPrime(Num)
Dim varNum, varCtr, varLimit
varLimit = Round(Num/2)
For varCtr = 2 To varLimit
varNum = Num Mod varCtr
If varNum = 0 Then
IsPrime = False
Exit For
End If
Next
If varCtr >= varLimit Then
IsPrime = True
End If
End Function
MsgBox IsPrime(19)
Is This Answer Correct ? | 1 Yes | 3 No |
Answer / sayali
Dim prime, n
prime = TRUE
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
prime = False
Exit for
End if
Next
If prime then
msgbox "Yes! It is a Prime number"
Else
msgbox "No! it is not a prime number"
End if
Is This Answer Correct ? | 0 Yes | 2 No |
what is the purpose of the Reporter.ReportEvent in QTP and also please give the brief description about Reporter.ReportEvent ?
write a vb script to rename a folder from tree4 to tree7
when we use filter funtiom invb script(QTP)
Write VB script to convert from feet to inches(hint 1feet=12 inches)
Mention what are the rules to name variable in vbscript?
How to select a value from a list box by using Selenium web-driver?
Is vbscript language a case-sensitive language and what does it mean?
I am running a windows based application.While running the script on QTP ,The Application pop-up an Error Message as "object Disabled" in two different scenarios Scenario 1-->The Application pop-up up a Message for Max Session Reached(as the application is set to hold 2 session and if if crosses the pre-defined limit then the error message pop-up) Scenario 2-->When Network connectivity is disabled the Application screen gets greyed out in colour with no operation possible. Now through Exception handling features in QTP ,we need to do the following For Scenarion 1-->Through Exception handling we need to just accept the Message pop-up in the Application and and resume with the call function as is for Scenario 2--> Through Exception Handling featutes on QTP we need to shut down the client , restart the client and resume the call functions as it is Note: The Application returns an Error Message as "object disabled" in both the cases i.e for pop-up message and when the Apllication getting greyed out due to Network failure how can we enhance the script in such a way that for the same error message retured by the application in two different and how to handle them????
HI how can handle dynamic image through vb script example we have to create email id fill the edit box(these latters change wrong password) i am wating your answer
what is the features of visual basic?
Mention if qtp generates vbscript code as we record actions, can't it possible to directly write using vbscript code when qtp does the same thing too?
What is wrong with the following code: <%afname="header.asp"%><!?#include file ="<%=afname%>"?>