Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click Dim euro As String = InputBox("Geef je bezittingen in centen in", "ingave") Dim nrCent As Integer If Integer.TryParse(euro, nrCent) Then Dim values() As Integer = {5000, 2000, 1000, 500, 100, 50, 20, 10, 5, 2} Dim names() As String = {"50 euro", "20 euro", "10 euro", "5 euro", "1 euro", "50 cent", "20 cent", "10 cent", "5 cent", "2 cent"} Dim nrUnit(UBound(values)) As Integer Dim i As Integer For i = 0 To UBound(values) nrUnit(i) = nrCent \ values(i) Next Dim a As String = "aantal 1 cent= " & nrCent & Chr(13) For i = UBound(values) To 0 Step -1 If nrUnit(i) <> 0 Then a &= "aantal " & names(i) & " = " & nrUnit(i) & Chr(13) End If Next MessageBox.Show(a, "antwoord") End If