Exercise
Triangle
Objetive
Write a Visual Basic (VB.Net) program that prompts for a symbol and a width, and displays a triangle of that width, using that number for the inner symbol, as in this example:
Enter a symbol: 4
Enter the desired width: 5
44444
4444
444
44
4
Code
Imports System
Public Class exercise50
Public Shared Sub Main()
Console.Write("Enter a number: ")
Dim n As Integer = Convert.ToInt32(Console.ReadLine())
Console.Write("Enter the desired width: ")
Dim width As Integer = Convert.ToInt32(Console.ReadLine())
Dim height As Integer = width
For row As Integer = 0 To height - 1
For column As Integer = 0 To width - 1
Console.Write(n)
Next
Console.WriteLine()
width -= 1
Next
End Sub
End Class