Square Learn programming Visual Basic (VB.net)

Lesson:

Flow Control


Exercise:

Square 56


Objetive:

Write a Visual Basic (VB.net) program which asks for a number and a width, and displays a square of that width, using that number for the inner symbol, as in this example:

Enter a number: 4
Enter the desired width: 3

444
444
444


Code:

Imports System
Public Class exercise34
    Public Shared Sub Main()
        Dim n As Integer
        Dim row, column As Integer
        Console.Write("Enter a number: ")
        n = Convert.ToInt32(Console.ReadLine())
        Console.Write("Enter the desired: ")
        width = Convert.ToInt32(Console.ReadLine())
        row = 0

        While row
            column = 0

            While column
                Console.Write(n)
                column += 1
            End While

            Console.WriteLine()
            row += 1
        End While
    End Sub
End Class