Sie sind auf Seite 1von 2

PROGRAMA N| 01: Elaborar un programa para similar la temperature en la ciudad de

Huaraz para un mes cualquiera y que se verifique la cantidad de nmeros encima y


debajo del promedio.



Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim NS, i, CNEP, CNDP As Integer
Dim TI, TS, T(0 To 100), ST, P As Double

NS = Val(TextBox1.Text)
TI = Val(TextBox2.Text)
TS = Val(TextBox3.Text)
REM PROCESO DE DATOS
For i = 0 To NS - 1
T(i) = Rnd() * (TS - TI) + TI
TextBox4.Text = TextBox4.Text & "[t" & i + 1 & "] = " & Format(T(i), "##
0") & Chr(13) & Chr(10)
ST = ST + T(i)
Next i
P = ST / NS
For i = 0 To NS - 1
If P < T(i) Then
CNEP = CNEP + 1
End If
If P > T(i) Then
CNDP = CNDP + 1
End If

Next
TextBox5.Text = Str$(CNEP)
TextBox6.Text = Str$(CNDP)
TextBox7.Text = Str$(P)

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox1.Focus()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
End
End Sub
End Class

Das könnte Ihnen auch gefallen