hi,
i was adding the two numbers in qtp scripts but i didn't get
the answer. see my below script, i dont know wht is the problem.

i passed the value a=3 b= 2, i got the ans 32 instead of 5.
i thing the problem is to be c = a+b

my mail id karthis4u@gmail.com

Dim a, b, c
a = inputbox("enter the a ")
b = inputbox("enter the b ")
c = a + b
print c

Answers were Sorted based on User's Feedback



hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / deepak singh

hi

Use CINT Function:: correct code is

Dim a, b, c
a =cint( inputbox("enter the a "))
b =cint( inputbox("enter the b "))
c = a + b
msgbox c


send mail if you have any query:

ccna_deepak@yahoo.com

Is This Answer Correct ?    21 Yes 2 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / rayudu

a= inputbox("Enter the value a")
b=inputbox("Enter the value b")
c=int(a)+int(b)
msgbox c

Is This Answer Correct ?    15 Yes 0 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / qa

hi

Use CINT Function:: correct code is

Dim a, b, c
a =cint( inputbox("enter the a "))
b =cint( inputbox("enter the b "))
c = a + b
msgbox c

Is This Answer Correct ?    8 Yes 0 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / praveen

Dim a, b, c

a =3
b =2
c = a + b
msgbox c

Is This Answer Correct ?    4 Yes 0 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / debee prasad kar

u have to use CINT function which is a conversion
function.If we not use this function then whatever we enter
in inputbox that will be treated as sting.so CINT function
converts from string to integer.
Code:
dim a,b,c
a= cint(inputbox("enter the first number"))
b= cint(inputbox("enter the second number"))
c=cint(a+b)
msgbox c

Is This Answer Correct ?    1 Yes 0 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / prasad v

hello
which ever the code you have written will be doing
cancatenation by accepting as characters.
if you provide inputs as a="abc" and b="xyz" then output
will be "abcxyz" right.

if you add two numbers you can go for this below code
function sum(a,b)
c=a+b
msgbox c
end function

calling the function
sum 2,3 then you will get output as 5

Is This Answer Correct ?    5 Yes 6 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / kavi

Hi,

prasad's code was right.. but we should pass values for the
function sum
dim a,b,c
function sum(a,b)
c=a+b
msgbox c
end function
x=sum(3,2)

Is This Answer Correct ?    2 Yes 4 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / ram

Dim a, b, c
a = inputbox("enter the a ")
b = inputbox("enter the b ")
c = a + b
msgbox(&c)

Is This Answer Correct ?    1 Yes 7 No

Post New Answer

More QTP Interview Questions

Hi Guys, I want to place all of my values which i am getting it from a loop in to a global shee. For that i had written the script like this For i = 1 to ECOs-1 ECO = List(i).GetROProperty("innertext") DataTable.AddSheet("ECOList") DataTable.GetSheet("ECOList").AddParameter "ECOList",ECO AbortECO = DataTable.GetSheet("ECOList").GetParameter ("ECOList").Value msgbox AbortECO DataTable.GetSheet("ECOList").SetNextRow Using the above script, whenever the loop iterates it is creating new column "ECOLIST" in the sheet called "ECOLIST". It means, the values are displaying in the column wise even though i added the script " DataTable.GetSheet("ECOList").SetNextRow" . The cursor is not moving to the next line. Anybody help me out how to pass the values from script to the excel(Global/Local) sheet. Pls let me know @ nbabu11@gmail.com if you are not clear about the question.

0 Answers  


How to retrive XML file data in QTP ? using Script(Chandana)

6 Answers   Wipro,


Hi, I got some difficulties in automating a web check box in a peoplesoft application. Let me explain the scenario, When clicked on a look up button in the application, it navigates to a new page with check boxes and respective options. Below is the source code for one check box and its option. <input type='checkbox' name='H1AU_BUNDLE_WRK_H1AU_SELECT_CH$2' id='H1AU_BUNDLE_WRK_H1AU_SELECT_CH$2' tabindex='34' value="Y" onclick="this.form.H1AU_BUNDLE_WRK_H1AU_SELECT_CH$chk$2.valu e=(this.checked?'Y':'N');submitAction_win0 (this.form,this.name);" /> </td> <td align='left' class='PSLEVEL1GRIDODDROW' > <span class='PSEDITBOX_DISPONLY' >$29 - $29 Cap with FREE Mobile</span> I want to parametrize using "$29 - $29 Cap with FREE Mobile". I am not aware of how to parametrize this. Currently I am parametrizing with 'H1AU_BUNDLE_WRK_H1AU_SELECT_CH$2' Can any one please help me out with this??/

0 Answers  


Write script to fetch the data from global sheet where row number is 3 and parameter is "text"

3 Answers   Accenture, Thomson Reuters,


in qtp 3 sheets is there in data table like global, action1, action2. I want to check the rows and columns in action2. how can check using script?

2 Answers   Polaris,


How many types of recording modes in qtp? Describe each type with an example where we use them?

0 Answers  


I am using descriptive programming for my project.when QTP deosn't identity or recognize a object by record and playback method,is it possible to make QTP identify that object using descriptive programming? Note: The object doesn't have unique properties and same properties used in Record and playback are only available, no extra properties are defined.

3 Answers  


what type of frame work used in your company?

2 Answers   HCL,


what is smart identification?

7 Answers  


can u please explain what is the exact difference between qtp8.2 and 9.0

0 Answers  


what is the silent mode in WR?

1 Answers  


Without using gui map editor we can recognize the application in winrunner ?

0 Answers  


Categories