I am having trouble creating a program that finds the maximum number out of an input set of numbers. Any help?

Recommended Answers

All 2 Replies

a Normal if then statement will suffice here. You do need to give us more information though - how/Where do you get the numbers?, where are they used, is it displayed in a list etc?

'I lost touch with VB6
'If the code has any errors do notify

Dim arrayValues(ARRAY_LENGTH) As Integer 'Hope u fill the arrayValues
Dim iter As Integer 'Iterator
Dim biggestNumber As Integer 'Temporary Variable

biggestNumber = arrayValues(0)

For iter = 1 To UBound(arrayValues) - 1
    If arrayValues(iter) > biggestNumber Then
        biggestNumber = arrayValues(iter)
    End If
Next iter

MsgBox biggestNumber

DEFN.....

assign the first number of the array in a Temporary variable (biggestNumber).
Repeatedly check all the other array elements with biggestNumber
If the array element is greater than the biggestNumber then assingn that element to biggestNumber

At the end of the iteration you will find the biggestNumber having the biggest number

Hope that helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.