adspace


write a vb script to check equal two 2*2 matrix

Answer Posted / Garima Agrawal

Here's an example VBScript code for your request:

```
Dim arr1, arr2
arr1 = Array(Array(0, 0), Array(0, 0)) ' First matrix
arr2 = Array(Array(0, 0), Array(0, 0)) ' Second matrix

' User inputs the values for the first matrix
arr1(0, 0) = InputBox("Enter element (0,0) of first matrix: ")
arr1(0, 1) = InputBox("Enter element (0,1) of first matrix: ")
arr1(1, 0) = InputBox("Enter element (1,0) of first matrix: ")
arr1(1, 1) = InputBox("Enter element (1,1) of first matrix: ")

' User inputs the values for the second matrix
arr2(0, 0) = InputBox("Enter element (0,0) of second matrix: ")
arr2(0, 1) = InputBox("Enter element (0,1) of second matrix: ")
arr2(1, 0) = InputBox("Enter element (1,0) of second matrix: ")
arr2(1, 1) = InputBox("Enter element (1,1) of second matrix: ")

' Check if the matrices are equal
If arr1(0,0) = arr2(0,0) And arr1(0,1) = arr2(0,1) And arr1(1,0) = arr2(1,0) And arr1(1,1) = arr2(1,1) Then
WScript.Echo "The matrices are equal.""
Else
WScript.Echo "The matrices are not equal.""
End If
```

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

No New Questions to Answer in this Category !!    You can

Post New Questions

Answer Questions in Different Category