Belajar Mathemathic Melalui VB


Belajar Array pada mathemathic

‘Finding Max Value

‘Deklarasi
Option Explicit
Dim A(20), num, i, j, max As Integer
————————————————

Private Sub Command1_Click()
Print “Your array contains:”
For i = 0 To num – 1
    Print A(i)
Next i
Print “Maximum Value= “; max
End Sub
Private Sub Form_Load()
num = InputBox(“Initialize your array [1-20]:”)

For i = 0 To num – 1
    A(i) = InputBox(“Enter your array:”)
Next i

‘find maximum
max = A(0)
For i = 0 To num – 1
    If max < A(i) Then
        max = A(i)
    End If
Next
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s