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/)
-   -   Q2:find maximum element in a matrix of 2x2 (http://bzupages.com/f237/q2-find-maximum-element-matrix-2x2-6868/)

shmsa 06-12-2009 04:56 PM

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



All times are GMT +5. The time now is 03:22 AM.

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