BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   Visual Programming (http://bzupages.com/237-visual-programming/)
-   -   Adding two matrices of same order (http://bzupages.com/f237/adding-two-matrices-same-order-7022/)

taha khan 10-12-2009 11:22 PM

Adding two matrices of same order
 
Adding two Matrices
Code:


Module Matadd


  Sub Main()
      Dim i, j As Integer
      Dim Matrix1 As Integer(,) = New Integer(2, 3) {}
      Dim Matrix2 As Integer(,) = New Integer(2, 3) {}
      For i = 0 To 1
          For j = 0 To 2
              Console.Write("Enter an element")
              Matrix1(i, j) = Console.ReadLine
          Next

      Next

      Console.Write("Matrix 1 is " & vbCrLf)
      For i = 0 To 1
          For j = 0 To 2
              Console.Write(Matrix1(i, j) & vbTab)
          Next
          Console.Write(vbCrLf)
      Next

      For i = 0 To 1
          For j = 0 To 2
              Console.Write("Enter an element")
              Matrix2(i, j) = Console.ReadLine
          Next

      Next

      Console.Write("Matrix 2 is " & vbCrLf)
      For i = 0 To 1
          For j = 0 To 2
              Console.Write(Matrix2(i, j) & vbTab)
          Next
          Console.Write(vbCrLf)
      Next

      Console.Write("After adding Matrix1 and Matrix2 result is" & vbCrLf)
      For i = 0 To 1
          For j = 0 To 2
              Console.Write(Matrix1(i, j) + Matrix2(i, j) & vbTab)
          Next
          Console.Write(vbCrLf)
      Next

  End Sub



All times are GMT +5. The time now is 04:08 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.