A teacher wants the program to:
show a visual representation of a multiplication

E.G
3 x 4

This is as far as I can go

``````Module Module1

Sub Main()
Dim a, b As Integer
Dim star As String = "*"

Dim rand As New Random
a = rand.Next(1, 10)
b = rand.Next(1, 10)

Console.WriteLine(a & " X " & b)
Dim sum As Double = a * b

Dim i, x As Integer

If a > b Then
i = b
Else
i = a
End If
For x = 1 To i
Console.Write(star)
Console.WriteLine(star)
Next
Console.WriteLine()
Console.WriteLine(sum)
End Sub

End Module``````

## All 3 Replies

1. Why are you calling the multiplication result `sum`?
2. Why are you storing an integer result in a `Double`?
3. Why aren't you reading the user response from the console?
4. Why are you comparing a and b?

Use the StrDup method instead of using a loop.

PS. `Code Snippet` is to be used only for working (debugged), commented, and documented code.

I used the following code to correct my issue.

``````Sub Main()
'Initialize variables
Dim first As New Random
Dim second As New Random
Dim num1 = first.Next(1, 10)
Dim num2 = second.Next(1, 10)
Dim c As Char = "*"
'Output Random numbers
Console.WriteLine(num1 & " x " & num2)
For index = 1 To num2
Console.WriteLine(StrDup(num1, c))
Next
Dim guess As Integer = Console.ReadLine()
Dim answer As Integer = num1 * num2
'Set Conditions
Else