This Visual Basic program calculates the average of 5 student scores entered into text boxes and displays the result. When the calculate button is clicked, it takes the values from each text box, converts them to integers, sums them, and divides the total by 5 to calculate the average, which is then displayed in a sixth text box.
This Visual Basic program calculates the average of 5 student scores entered into text boxes and displays the result. When the calculate button is clicked, it takes the values from each text box, converts them to integers, sums them, and divides the total by 5 to calculate the average, which is then displayed in a sixth text box.
This Visual Basic program calculates the average of 5 student scores entered into text boxes and displays the result. When the calculate button is clicked, it takes the values from each text box, converts them to integers, sums them, and divides the total by 5 to calculate the average, which is then displayed in a sixth text box.
Programa en Visual que calcula el promedio de 5 alumnos y muestra el
resultado
Public Class Form1
Private Sub Label1_Click(sender As System.Object, e As System.EventArgs) Handles
Label1.Click
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs)
Handles Button1.Click Dim vec = {TextBox1, TextBox2, TextBox3, TextBox4, TextBox5} Dim vector(5), j, acum As Integer For j = 0 To 4 vector(j) = vec(j).Text Next For j = 0 To 4 acum = acum + vector(j) Next TextBox6.Text = acum / 5 End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles