Вобщем есть эн чисел, а как из них найти самое большое?
Заранее спс
etalon = massiv(0)
'Option Rtfm On
'Option Msdn Visit
'Option Must Work
Public Sub FindMaximum()
On Error Resume Next
Dim arrDef() As Long
Dim sNew As String
Dim lUb As Long
Dim i As Long
Dim lMax As Long
Do
DoEvents
sNew = InputBox("Enter a number to add or 'X' to skip")
If Len(sNew) Then
If Asc(sNew) = vbKeyX Then Exit Do
lUb = UBound(arrDef)
If Err <> 0 Then Err.Clear
ReDim Preserve arrDef(lUb + 1)
arrDef(lUb) = CLng(sNew)
End If
Loop
lMax = arrDef(0)
For i = 2 To lUb
If arrDef(i - 1) > lMax Then lMax = arrDef(i - 1)
Next i
MsgBox "Maximum Element = " & Trim$(Str$(lMax))
End Sub
o = chislo(0)
for i = 0 to N
if o < chislo(n) then o = chislo(n)
next i
lMax = arrDef(0)
For i = 2 To lUb
If arrDef(i - 1) > lMax Then lMax = arrDef(i - 1)
Next i
o = chislo(0)
for i = 1 to N
if o < chislo(i) then o = chislo(i)
next i
Сейчас этот форум просматривают: AhrefsBot, Google-бот, SemrushBot и гости: 34