You are on page 1of 1

1.

zModule Module1

Sub Main()
Dim batas As Integer
Dim bilangan(10) As Integer
Dim max As Integer = 999999
Dim min As Integer = -999999
Dim BilMax, BilMin As Integer
For batas = 0 To 9
Console.Write("masukkan bil {0} = ", batas + 1)
bilangan(batas) = Console.ReadLine
If (bilangan(batas) > max) Then
max = bilangan(batas)
BilMax = batas
End If
If (bilangan(batas) < min) Then
min = bilangan(batas)
BilMin = batas
End If

Next
Console.WriteLine("nilai max : {0} dan min : {1}", max, min)
Console.ReadLine()

End Sub

End Module

Dim bil(10), maks, min As Integer


bil(0) = Console.ReadLine()
bil(1) = Console.ReadLine()
bil(2) = Console.ReadLine()
bil(3) = Console.ReadLine()
bil(4) = Console.ReadLine()
bil(5) = Console.ReadLine()
bil(6) = Console.ReadLine()
bil(7) = Console.ReadLine()
bil(8) = Console.ReadLine()
bil(9) = Console.ReadLine()
maks = -2147483648
min = 2147483647
For a = 0 To 9
If bil(a) > maks Then
maks = bil(a)
End If
If bil(a) < min Then
min = bil(a)
End If
Next
Console.WriteLine("Maks = {0}", maks)
Console.WriteLine("Min = {0}", min)
Console.ReadKey()

End Sub

End Module

You might also like