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

Lab Exercise 5 Repetition Structure

The code defines a class called Form1 that contains code to calculate the multiplication table of 7. It initializes variables for the multiplier, answer, and counter. A Do loop runs from 7 to 8, incrementing the multiplier each time. An inner For loop iterates from 1 to 13 in steps of 2, calculating the answer for each multiplication and adding it to a list box with the formatted string "i*multiplier=answer".

Uploaded by

Pabbura_Hati
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
376 views

Lab Exercise 5 Repetition Structure

The code defines a class called Form1 that contains code to calculate the multiplication table of 7. It initializes variables for the multiplier, answer, and counter. A Do loop runs from 7 to 8, incrementing the multiplier each time. An inner For loop iterates from 1 to 13 in steps of 2, calculating the answer for each multiplication and adding it to a list box with the formatted string "i*multiplier=answer".

Uploaded by

Pabbura_Hati
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

QUESTION 1 CODING FOR FORM: Public Class Form1 Dim multiplier As Integer Dim answer As Integer Dim i As Integer

Private Sub btnKlikUntukSifirTujuh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKlikUntukSifirTujuh.Click multiplier = 7 Do While multiplier < 8 For i = 1 To 13 Step +2 answer = i * multiplier ListBox1.Items.Add(i & "X" & multiplier & "=" & answer) Next i multiplier = multiplier + 1 Me.Show() Loop End Sub End Class

INTERFACE OUTPUT:

QUESTION 2 CODING FOR FORM 1: Public Class Form1 Dim i As Integer = 1 Dim num As Integer Dim total As Integer Dim n As Integer Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click n = txtNumber.Text While (i <= n) num = InputBox("Please enter value" & i & " : ") total = total + num i = i + 1 End While MessageBox.Show(" The Sum Is " & total / n, "Result") End Sub End Class OUTPUT INTERFACE:

You might also like