View Single Post
  #1  
Old 06-12-2009, 04:56 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
Smartass Q2:find maximum element in a matrix of 2x2

Code:
Module MaxinMatrix

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

            Next
        Next
        For i = 0 To 1
            For j = 0 To 1
                Console.Write(ar1(i, j) & vbTab)
            Next
            Console.Write(vbCrLf)
        Next
        max = 0
        For i = 0 To 1
            For j = 0 To 1
                If max < ar1(i, j) Then
                    max = ar1(i, j)
                End If
            Next
        Next
        Console.WriteLine(max)



    End Sub

End Module

Reply With Quote