SHARE
TWEET

Untitled

a guest Nov 19th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub Program1()
  2. Dim n As Integer
  3. Dim m As Integer
  4. Dim A() As Integer
  5. Dim A1() As Integer
  6. Dim B() As Integer
  7. Dim B1() As Integer
  8. Dim B2() As Integer
  9. Dim A2() As Integer
  10. Dim max As Integer
  11. Dim i As Integer
  12. Dim j As Integer
  13. Dim min As Integer
  14. Dim k As Integer
  15. Dim sled As Integer
  16. Dim mol As Double
  17.  
  18.  
  19.  
  20.  
  21. n = InputBox("vvedite kolvo strok matrisu A")
  22. m = InputBox("vvedite kolvo stolbov matrisu A")
  23.  
  24. If n > m Then
  25. ReDim A2(1 To n, 1 To n) As Integer
  26. ReDim B2(1 To n, 1 To n) As Integer
  27. max = n
  28. min = m
  29. Else
  30. ReDim A2(1 To m, 1 To m) As Integer
  31. ReDim B2(1 To m, 1 To m) As Integer
  32. max = m
  33. min = n
  34. End If
  35.  
  36.  
  37. ReDim A(1 To n, 1 To m) As Integer
  38. ReDim A1(1 To m, 1 To n) As Integer
  39. ReDim B(1 To m, 1 To n) As Integer
  40. ReDim B1(1 To n, 1 To m) As Integer
  41.  
  42.  
  43. For i = 1 To n
  44.  For j = 1 To m
  45.   A(i, j) = InputBox("vvedite A")
  46.   Next
  47.   Next
  48.  
  49.  
  50.  
  51. For i = 1 To m
  52.  For j = 1 To n
  53.   B(i, j) = InputBox("vvedite B")
  54.   Next
  55.   Next
  56.  
  57.  
  58. For i = 1 To n
  59.  For j = 1 To m
  60.  A1(j, i) = A(i, j)
  61.  Next
  62.  Next
  63.  
  64.  
  65.  For i = 1 To m
  66.  For j = 1 To n
  67.  B1(j, i) = B(i, j)
  68.  Next
  69.  Next
  70.  
  71.  
  72.   For i = 1 To max
  73.  For j = 1 To max
  74.  For k = 1 To min
  75.  A2(i, j) = A2(i, j) + A1(i, k) * A(k, j)
  76.  Next
  77.  Next
  78.  Next
  79.  
  80.   For i = 1 To min
  81.  For j = 1 To min
  82.  For k = 1 To max
  83.   B2(i, j) = B2(i, j) + B1(i, k) * B(k, j)
  84.   Next
  85.   Next
  86.   Next
  87.  
  88.  
  89.  For i = 1 To max
  90.  For j = 1 To max
  91.  If i = j Then
  92.  sled = sled + A2(i, j)
  93.  End If
  94.  Next
  95.  Next
  96.  
  97.  
  98.  For i = 1 To min
  99.  For j = 1 To min
  100.  mol = mol + B2(i, j) * B2(i, j)
  101.  Next
  102.  Next
  103.  
  104.  mol = Sqr(mol)
  105.  mol = mol - sled
  106.  MsgBox "otvet=" & mol
  107.  
  108. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top