Private Sub Form_Load() Dim i As Integer Dim Somma As Integer Dim Media As Double Dim V(1 To 30) As Integer Rem Estrazione valori Randomize For i = 1 To 30 V(i) = Int(Rnd() * 100) Next i Rem Calcolo della media Somma = 0 For i = 1 To 30 Somma = Somma + V(i) Next i Media = Somma / 30 Rem Inserimento dei risultati nella label lblRisultato.Caption = "" For i = 1 To 30 If V(i) < Media Then lblRisultato.Caption = lblRisultato. Caption & V(i) & Chr$(10) End If Next i End Sub |
Listato 1 La soluzione del secondo esercizio dello scorso numero |