View Single Post
  #1  
Old 06-12-2009, 04:45 PM
shmsa's Avatar
shmsa shmsa is offline
Grown up punk

 
Join Date: Oct 2007
Location: Muslim Town Multan
Posts: 195
Contact Number: 0322-6196713
Program / Discipline: BSIT
Class Roll Number: 07-22
shmsa is a jewel in the roughshmsa is a jewel in the roughshmsa is a jewel in the roughshmsa is a jewel in the rough
Default Assignment Q1:Add two matrices of 2x3 using vb console Application

Code:
Module additionMatrices

    Sub Main()
        Dim ar1 As Integer(,)
        ar1 = New Integer(1, 2) {}
        Dim i, j As Integer
        For i = 0 To 1
            For j = 0 To 2
                ar1(i, j) = Console.ReadLine()

            Next
        Next
        For i = 0 To 1
            For j = 0 To 2
                Console.Write(ar1(i, j) & vbTab)
            Next
            Console.Write(vbCrLf)
        Next


        Dim ar2 As Integer(,)
        ar2 = New Integer(1, 2) {}

        For i = 0 To 1
            For j = 0 To 2
                ar2(i, j) = Console.ReadLine()

            Next
        Next
        For i = 0 To 1
            For j = 0 To 2
                Console.Write(ar2(i, j) & vbTab)

            Next
            Console.Write(vbCrLf)
        Next

        For i = 0 To 1
            For j = 0 To 2
                Console.Write(ar1(i, j) + ar2(i, j) & vbTab)
            Next
            Console.Write(vbCrLf)
        Next
    End Sub

End Module

Reply With Quote