Hacer un programa o algoritmo que de una lista de 10 números calcular la media y determinar cuántos son mayores que 11, cuántos son iguales y cuántos son menores.
Codigo Fuente en Visual Basic
Public Class Form1 Dim eq As Integer = 0 Dim ma As Integer = 0 Dim men As Integer = 0 Dim sum As Integer = 0 Dim prom As Integer = 0 Dim N As Integer Dim c As Integer = 0 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click c = c + 1 If (c <> 11) Then N = TextBox1.Text If (N = 11) Then eq = eq + 1 Else If (N > 11) Then ma = ma + 1 Else men = men + 1 End If End If sum = sum + N Else TextBox2.Text = "El promedio es: " + Trim(sum / 10) + " y " + Trim(eq) + " iguales a once " + Trim(ma) + " mayores a once " + Trim(men) + " menores a once" End If End Sub End Class
0 comentarios:
Publicar un comentario