Two dimensional array Learn programming Visual Basic (VB.net)

Lesson:

Arrays, Structures and Strings


Exercise:

Two dimensional array 40


Objetive:

Write a Visual Basic (VB.net) program to ask the user for marks for 20 pupils (2 groups of 10, using a two-dimensional array), and display the average for each group.


Code:

Imports System
Public Class exercise77
    Public Shared Sub Main()
        Dim puntuations As Single(,) = New Single(9, 9) {}

        For i As Integer = 0 To 2 - 1

            For j As Integer = 0 To 10 - 1
                Console.WriteLine("Enter the puntuation {0} group {1}: ", j + 1, i + 1)
                puntuations(i, j) = Convert.ToSingle(Console.ReadLine())
            Next
        Next
    End Sub
End Class