0% found this document useful (0 votes)
29 views

Exercise 6

This code takes a number input from a text box, uses a while loop to increment a counter and track variable until the counter exceeds the input number, then divides the track variable by the counter to calculate the average and displays the number and result on a label.

Uploaded by

api-308657631
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Exercise 6

This code takes a number input from a text box, uses a while loop to increment a counter and track variable until the counter exceeds the input number, then divides the track variable by the counter to calculate the average and displays the number and result on a label.

Uploaded by

api-308657631
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Dim number As Integer = TextBox1.Text
Dim counter As Integer = 0
Dim track As Integer = 0

While counter <= number


counter = counter + 1
track = track + counter
End While
Dim num As Integer = track / counter
Label2.Text = Label2.Text + number.ToString + " is " + num.ToString

End Sub

End Class

You might also like