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

Can you import and export data from XLS and how?

4 Answers  


How to extract the data in the below scenario and dump it in the excel? Link1 Link2 Link3 Link4 numberlink1 text text text numberlink2 text text text numberlink3 text text text numberlink4 text text text So, Here is my question? -- It is a matrix but is not a web table(QTP does not recognize it as a web table) -- Link1, link2 and link3 are links under which text is available -- numberlink1 to numberlink4 are again LINKS -- All the others displayed are text only I want to extract the data in the above scenario and dump it into an excel in the same scenario as it is displayed above. Kindly help.. Thank you

0 Answers  


What are the disadvantages of Recovery Scenarios in QTP ?

3 Answers  


Inserting a Call to Action is not importing all columns in Datatable of globalsheet. Why?

1 Answers   Crea,


write the regular expression for date format of mm/dd/yy?

10 Answers   CTS, HCL,






What is the entry and exit point of automation testing

2 Answers   Infosys,


anybody wants to learn QTP with realtime implementations and complete framwork contact to this mail id ciraaj@gmail.com

1 Answers  


can any body tell me all of the release dates of QTP?????..... thanks in adv!

3 Answers  


hi is there any chance to change encoding the password

3 Answers  


What is the "Release Notes", what it cosists? Key components in Release Notes ?

2 Answers  


HoW to open QTP in Real time.after getting the qtp window how to log in .pl answer real time people

3 Answers   GE,


Can anyone help.i need total excelsheet operations,shortcuts in testing environment from starting onwards....

0 Answers  


Categories