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/)
-   -   Subtracting two matrices of same order (http://bzupages.com/f237/subtracting-two-matrices-same-order-7023/)

taha khan 10-12-2009 11:25 PM

Subtracting two matrices of same order
 
Subtracting two Matrices
Code:





Module Matsub


  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 Subtracting 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 01:41 AM.

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