TUGAS 1
Membuat form
seperti di bawah ini
Kemudian masukkan codingnya :
Public Class Form2
Private Function
fstat(ByVal ParamArray
args() As Object)
As Single()
Dim hasil(3) As Single
Dim i As Integer
For i = 0 To
UBound(args)
hasil(0) = hasil(0) + args(i)
If i = 0 Then
hasil(1) = args(i)
hasil(2) = args(i)
End If
If hasil(1) > args(i) Then
hasil(1) = args(i)
If hasil(2) < args(i) Then
hasil(2) = args(i)
Next i
Return hasil
End Function
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Dim statistik As Single() = fstat(1, 6, 2, 7, 3, 9, 4, 10, 8, 5)
TextBox1.Text = statistik(0)
TextBox3.Text = statistik(1)
TextBox2.Text = statistik(2)
End Sub
End Class
Dan hasilnya adalah
Keterangan :
Dalam coding di latihan adalah :
Dim statistik As Single() = fstat(1, 6, 2, 7, 3, 9, 4, 10, 8, 5)
TextBox1.Text = statistik(0)
TextBox2.Text = statistik(1)
TextBox3.Text = statistik(2)
Dan kemudian diperbaharui menjadi :
Dim statistik As Single() = fstat(1, 6, 2, 7, 3, 9, 4, 10, 8, 5)
TextBox1.Text = statistik(0)
TextBox3.Text = statistik(1)
TextBox2.Text = statistik(2)
0 komentar:
Posting Komentar