# Answer to Exercise 5

Another easy one! Just loop round and multiply by 2 and 3 for the doubles and trebles. The single scores are just the loop number, which is the letter i in the code below.

### C# NET Answer

```private void btnDartScores_Click(object sender, EventArgs e) {

for (int i = 1; i < 21; i++) {

int single_score;
int double_score;
int treble_score;

single_score = i;
double_score = i * 2;
treble_score = i * 3;

listBox1.Items.Add("number " + i + ": " + single_score + "," + double_score + "," + treble_score);
}
}
```

### VB NET Answer

```Private Sub btnDartScores_Click(sender As Object, e As EventArgs) Handles btnDartScores.Click

For i = 1 To 20

Dim single_score As Integer = 0
Dim double_score As Integer = 0
Dim treble_score As Integer = 0

single_score = i
double_score = i * 2
treble_score = i * 3

ListBox1.Items.Add("number" & i & ": " & single_score & "," & double_score & "," & treble_score)

Next

End Sub

```

### Java Answer

```public static void main(String[] args) {

for (int i = 1; i < 21; i++)
{
int single_score;
int double_score;
int treble_score;

single_score = i;
double_score = i * 2;
treble_score = i * 3;

System.out.println("number " + i + ": " + single_score + "," + double_score + "," + treble_score);
}
}
```