"Ingresa Un Numero" "Desea Agregar Otro Numero": Form1 Eventargs
The document contains code for 3 different button click event handlers in a Windows Forms application. The first handler calculates the maximum and minimum numbers entered by the user. The second implements the Collatz conjecture to generate a sequence from a user-entered number. The third calculates statistics on grades entered by the user such as number of passing/failing grades, minimum grade, and average grade.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
22 views
"Ingresa Un Numero" "Desea Agregar Otro Numero": Form1 Eventargs
The document contains code for 3 different button click event handlers in a Windows Forms application. The first handler calculates the maximum and minimum numbers entered by the user. The second implements the Collatz conjecture to generate a sequence from a user-entered number. The third calculates statistics on grades entered by the user such as number of passing/failing grades, minimum grade, and average grade.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim num, may, men, res As Integer Do num = InputBox("Ingresa un numero") ListBox1.Items.Add(num) res = MsgBox("Desea agregar otro numero", 36) If ListBox1.Items.Count = 0 Then may = num Else If num > may Then may = num End If End If If ListBox1.Items.Count = 0 Then men = num Else If num < men Then men = num End If End If Loop Until res = 7 Label3.Text = may Label4.Text = men End Sub End Class
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim num As Integer num = InputBox("Ingresa un numero") ListBox1.Items.Add(num) Do While num <> 1 If num Mod 2 = 0 Then num /= 2 ListBox1.Items.Add(num) Else num = (num * 3) + 1 ListBox1.Items.Add(num) End If Loop End Sub End Class
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim cal, con1, con2, con3, a1, a2, a3, res, men As Integer Dim p, pg As Double Do cal = InputBox("Ingresa la calificacion") con1 = con1 + 1 a1 = a1 + cal If cal >= 7 Then ListBox1.Items.Add(cal) con2 = con2 + 1 a2 = a2 + cal End If If cal < 7 Then ListBox2.Items.Add(cal) con3 = con3 + 1 a3 = a3 + cal End If If ListBox2.Items.Count = 0 Then men = cal Else If cal < men Then men = cal End If End If p = (con3 * 100) / con1 pg = a1 / con1 res = MsgBox("Desea agregar otra calificacion", 36) Loop Until res = 7 TextBox1.Text = con2 TextBox2.Text = p TextBox3.Text = men TextBox4.Text = pg End Sub End Class