cs_Miss51
Messages postés12Date d'inscriptionlundi 4 septembre 2006StatutMembreDernière intervention11 septembre 2006
-
11 sept. 2006 à 14:24
cs_DARKSIDIOUS
Messages postés15814Date d'inscriptionjeudi 8 août 2002StatutMembreDernière intervention 4 mars 2013
-
11 sept. 2006 à 17:51
Bonjour, Je dois écrire une fonction qui reçoit en paramètre trois nombres entiers. Elle renvoie le minimum de ces trois nombres. Je odis également, écrire le programme principal qui teste cette fonction.
Est-ce que c'est ça :
Sub main()
MsgBox Minimum(2, 7, 10)
End Sub
Function Minimum(nb1 As Integer, nb2 As Integer, nb3 As Integer) As Integer
If nb1 < nb2 < nb3 Then
Minimum = nb1
Else
Minimum = nb2
Minimum = nb3
End If
End Function
Public Function ValMin(ParamArray t()) As Integer
Dim minVal As Integer
minVal = t( LBound (t))
For i = LBound(t) + 1 To UBound(t)
If t(i) < minVal Then
minVal = t(i)
End If
Next i
ValMin = minVal
End Function
tu appele la fonction ainsi :
toto = ValMin(1, 5, 6, 8, 14, 3, 7, 12)
---- Sevyc64 (alias Casy) ----<hr size="2" width="100%" /># LE PARTAGE EST NOTRE FORCE #