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/index.php)
-   Visual Programming (http://bzupages.com/forumdisplay.php?f=237)
-   -   Finding Maximum Element in a two dimensional array (http://bzupages.com/showthread.php?t=7024)

taha khan 10-12-2009 11:31 PM

Finding Maximum Element in a two dimensional array
 
Finding Maximum Element in a two dimensional array

Code:


Module Matmax


    Sub Main()
        Dim i, j, max 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("Maximum element of Matrix 1 is " & vbCrLf)
        max = 0
        For i = 0 To 1
            For j = 0 To 2
                If Matrix1(i, j) > max Then
                    max = Matrix1(i, j)
                End If
            Next
           
        Next
Console.Write(max)
       
    End Sub



End Module



All times are GMT +5. The time now is 04:46 PM.

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