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

Today only i joined in this site. Can u please tell me definition of parameterization. and how i can do the parameterization?

6 Answers  


If I change the property value at runtime is it effect is object repository?

0 Answers  


how to select particular value from the combobox in the current page which is entred in the previous page editbox after parameterization?

5 Answers   Ordain Solutions,


What is DOM

2 Answers  


How to Run a Test using QTP?

1 Answers  






What are the types of properties that quick test learns while recording?

0 Answers  


what testplan contents and what test strategy contents,what is the diff b/w them

0 Answers  


How to swap two numbers by using parameter passing method byref in a fucntion and return the result to outside of the function?

1 Answers   CTS, IBM, London,


is it possible to add sheets to excel at runtime

1 Answers  


Hi there, I've installed a trial version of QTP to see if it works with my product but I cant automate selecting windows from a tree view? Can anyone give me any pointers? Many Thanks

0 Answers  


What is action? How many types of actions are there in qtp?

0 Answers  


hi i need to learn qtp its very urgent..pls tell me who is the best faculty for qtp in hyd..... and i plan to go foe mindq nageshwar rao? its good or not?

2 Answers  


Categories