0

This Is my Question :

Using loop statement, write a VB .NET program that prompts an integer in the range of 1 to 10 (both inclusive) from the user in an input box, and prints a multiplication table of the integer entered.
For example, when the user enters 8, your program should display the following:

 1  2  3  4  5  6  7  8

1 1 2 3 4 5 6 7 8
2 2 4 6 8 10 12 14 16
3 3 6 9 12 15 18 21 24
4 4 8 12 16 20 24 28 32
5 5 10 15 20 25 30 35 40
6 6 12 18 24 30 36 42 48
7 7 14 21 28 35 42 49 56
8 8 16 24 32 40 48 56 64

I'm URGENT with This Question..Thank for helping if you know the solution!!

My coding so far until here :

 Dim num, x, y As Integer
        Dim output As String = " "
        For x = 1 To num
            For y = 1 To num
                output = output & x * y
                ListBox1.Items.Add(output)
            Next y
            ListBox1.Items.Add("")
        Next x
3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by hericles
0

You are pretty close but you aren't setting num to the textbox value that is the upper limit so that needs to be fixed of course.
After For x = 1 To num, include output = output & x.ToString & "."
That'll give you the 1., 2., 3. you want at the start of each row. You also need to reset output after adding it to the listbox so the previous value is discarded.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.