Dim yazili(3) As Integer
Dim sozlu(2) As Integer
Dim ort, yazilitop, sozlutop, ytop, stp As Integer
yazili(0) = Integer.Parse(txty1.Text)
yazili(1) = Integer.Parse(txty2.Text)
yazili(2) = Integer.Parse(txty3.Text)
sozlu(0) = Integer.Parse(txts1.Text)
sozlu(1) = Integer.Parse(txts2.Text)
ort = 0
ytop = 0
stp = 0
For k As Integer = 0 To 3
If yazili(k) > 0 Then
yazilitop += yazili(k)
ytop += 1
End If
Next
For j As Integer = 0 To 2
If sozlu(j) > 0 Then
sozlutop += sozlu(j)
stp += 1
End If
Next
ort = (yazilitop + sozlutop) / (ytop + stp)
txtort.Text = Convert.ToString(Double.Parse(ort))