Rectangle Learn programming Visual Basic (VB.net)

Lesson:

First contact with Visual Basic (VB.net)


Exercise:

Rectangle


Objetive:

Write a Visual Basic (VB.net) program to ask the user for a number and then display a rectangle 3 columns wide and 5 rows tall using that digit. For example:

Enter a digit: 3
333
3 3
3 3
3 3
333


Code:

Imports System
Public Class exercise13
    Public Shared Sub Main()
        Dim x As Integer
        Console.Write("Enter a number: ")
        x = Convert.ToInt32(Console.ReadLine())
        Console.WriteLine("{0}{0}{0}", x)
        Console.WriteLine("{0} {0}", x)
        Console.WriteLine("{0} {0}", x)
        Console.WriteLine("{0} {0}", x)
        Console.WriteLine("{0}{0}{0}", x)
    End Sub
End Class

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.