0% found this document useful (0 votes)
28 views1 page

Zmodule Sub Dim As Integer Dim As Integer Dim As Integer Dim As Integer Dim As Integer For To

The document contains code to find the maximum and minimum values in an array of integers. It defines an array that holds 10 integer values input by the user. It then iterates through the array, tracking the largest and smallest values seen so far, and after the loop prints out the maximum and minimum values found.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views1 page

Zmodule Sub Dim As Integer Dim As Integer Dim As Integer Dim As Integer Dim As Integer For To

The document contains code to find the maximum and minimum values in an array of integers. It defines an array that holds 10 integer values input by the user. It then iterates through the array, tracking the largest and smallest values seen so far, and after the loop prints out the maximum and minimum values found.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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