Rectangle V2 Learn programming Visual Basic (VB.net)

Lesson:

Flow Control


Exercise:

Rectangle V2 14


Objetive:

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

Enter a number: 4
Enter the desired width: 3
Enter the desired height: 5

444
444
444
444
444


Code:

Imports System
Public Class exercises36
    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())
        Console.Write("Enter the desired height: ")
        height = 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