Diseñar un algoritmo que permita determinar la media aritmética de una lista de números positivos.
Solución
- Entrada: 15, 8, 5, 12
- Salida: 10
Public Class Form1 Dim b As Integer = 0 Dim sum As Double = 0.0 Dim cad As String = "" Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim num As Integer num = TextBox1.Text If (num <> 0) Then sum = sum + num b = b + 1 cad = cad + " " + Trim(num) End If TextBox2.Text = cad End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim media As Double media = sum / b TextBox3.Text = Trim(media) End Sub End Class
no era lo que buscaba
ResponderEliminarmuchas gracias!! me fue de mucha ayuda
ResponderEliminarGracias men :V Hailgrasa
ResponderEliminarNo funda chucha AÑA
ResponderEliminar