This document contains the code for a Visual Basic application that analyzes numbers entered by the user. When the user clicks button one, the number is added to a list box and used to update variables tracking the highest, lowest, sum, and counts of even and odd numbers. Button two displays the results in text boxes, and button three clears the text boxes and list for new input.
Original Description:
Primera Practica de Informatica Aplicada a La Ingenieria
Original Title
Primera Practica de Informatica Aplicada a La Ingenieria
This document contains the code for a Visual Basic application that analyzes numbers entered by the user. When the user clicks button one, the number is added to a list box and used to update variables tracking the highest, lowest, sum, and counts of even and odd numbers. Button two displays the results in text boxes, and button three clears the text boxes and list for new input.
This document contains the code for a Visual Basic application that analyzes numbers entered by the user. When the user clicks button one, the number is added to a list box and used to update variables tracking the highest, lowest, sum, and counts of even and odd numbers. Button two displays the results in text boxes, and button three clears the text boxes and list for new input.
PRIMERA PRACTICA DE INFORMATICA APLICADA A LA INGENIERIA
Public Class Form1
Public wmenor As Integer = 999999 Public sp, si As Integer Public wmayor, suma, x As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim numero, par, impar As Integer numero = TextBox1.Text ListBox1.Items.Add(numero) If numero > wmayor Then wmayor = numero End If If numero < wmenor Then wmenor = numero End If If numero Mod 2 = 0 Then par = numero sp = sp + par End If If numero Mod 2 <> 0 Then impar = numero si = si + impar End If suma = suma + numero x=x+1 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim prom As Double prom = suma / x TextBox2.Text = wmayor TextBox3.Text = wmenor TextBox4.Text = prom TextBox5.Text = Sp TextBox6.Text = si End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" ListBox1.Items.Clear() End Sub End Class