write a vb script to add two 2*2 matrix

Answers were Sorted based on User's Feedback



write a vb script to add two 2*2 matrix..

Answer / mudaseer

dim varr1(1,1),varr2(1,1),varr3(1,1)
for i=0 to 1
for j=0 to 1
varr1(i,j)=cint(inputbox("enter the number"))
next
next
for i=0 to 1 step 1
for j=0 to 1 step 1
varr2(i,j)=cint(inputbox("enter the number"))
next
next
for i=0 to 1 step 1
for j=0 to 1 step 1
varr3(i,j)=varr1(i,j)+varr2(i,j)
next
next
for i=0 to 1 step 1
for j=0 to 1 step 1
vstr1=vstr1 & varr1(i,j) & " "
vstr2=vstr2 & varr2(i,j) & " "
vstr3=vstr3 & varr3(i,j) & " "
next
vstr1=vstr1 & vbnewline
vstr2=vstr2 & vbnewline
vstr3=vstr3 & vbnewline
next
msgbox vstr1
msgbox vstr2
msgbox vstr3

Is This Answer Correct ?    23 Yes 7 No

write a vb script to add two 2*2 matrix..

Answer / pawan

Dim oArray1(1,1)
Dim oArray2(1,1)
Dim tArray(1,1)
oArray1(0,0)=8
oArray1(0,1)=9
oArray1(1,0)=5
oArray1(1,1)=-1
oArray2(0,0)=-2
oArray2(0,1)=3
oArray2(1,0)=4
oArray2(1,1)=0
tArray(0,0)=oArray1(0,0)* oArray2(0,0)+ oArray1(0,1)* oArray2(1,0)
tArray(0,1)=oArray1(0,0)* oArray2(0,1)+ oArray1(0,1)* oArray2(1,1)
tArray(1,0)=oArray1(1,0)* oArray2(0,0)+ oArray1(1,1)* oArray2(1,0)
tArray(1,1)=oArray1(1,0)* oArray2(0,1)+ oArray1(1,1)* oArray2(1,1)

Is This Answer Correct ?    4 Yes 5 No

Post New Answer

More VB Script Interview Questions

Check whether given Number is Even or Odd?

2 Answers   HDFC,


what is the differenece btwn scripting language and programming language

4 Answers  


Please Example programms on vbscript 1)writing functions and calling functions

2 Answers   CIL, TCS,


Explain few date functions in vbscript?

0 Answers  


Mention the rules for using option explicit statement?

0 Answers  






how to write basic programs in VB Script like addition, multiplication?

14 Answers  


How will you compare two strings in vbscript?

0 Answers  


Explain about constants in vb script?

0 Answers  


a;;b;c;;;d in this string output is abcd will come how can we do that in vbscript in QTP testing?

2 Answers  


How to assign a numeric value to a variable?

0 Answers  


How to scroll down a page while recording in qtp. suggest me any method apart from low level recording.

0 Answers  


What is the output of a + b in vbscript if a = 5 and b = 10?

0 Answers  


Categories