0% found this document useful (0 votes)
16 views1 page

Media Aritmética:: Solución

The document describes an algorithm to calculate the arithmetic mean of a list of positive numbers. It provides an example input of 15, 8, 5, 12 and output of 10. It then provides the Visual Basic code to implement this algorithm by taking user input, summing the numbers, counting them, and dividing the sum by the count to calculate the mean.

Uploaded by

kevin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views1 page

Media Aritmética:: Solución

The document describes an algorithm to calculate the arithmetic mean of a list of positive numbers. It provides an example input of 15, 8, 5, 12 and output of 10. It then provides the Visual Basic code to implement this algorithm by taking user input, summing the numbers, counting them, and dividing the sum by the count to calculate the mean.

Uploaded by

kevin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Media aritmtica:

Disear un algoritmo que permita determinar la media aritmtica de una lista de nmeros
positivos.

Solucin

Entrada: 15, 8, 5, 12

Salida: 10

Codigo Fuente en Visual Basic

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

function fac(n as long) as long


if n=0 then
fac=1
else
fac=n * fac(n-1)
end if
end function

You might also like