Exercise
Function write centered
Objetive
Write a Visual Basic (VB.Net) function to write centered on screen the text that is indicated as a parameter (supposing a screen width of 80 characters):
WriteCentered("Hello!");
Code
Imports System
Public Class exercise101
Public Shared Sub WriteCentered(ByVal text As String)
Dim i As Integer = 0
While i < 17
Console.WriteLine()
i += 1
End While
For i = 0 To 36 - 1
Console.Write(" ")
Next
Console.Write(text)
For i = 0 To 14 - 1
Console.WriteLine()
Next
End Sub
Public Shared Sub Main()
WriteCentered("Hello")
End Sub
End Class