VB.Net Program to print Numbers 1 to N in Right Triangle Format


Module Module1
    Sub Main()
        Dim sum As Integer = 0, i As Integer, k As Integer, n As Integer
        Console.WriteLine(“*** www.programmingposts.com ***”)
        Console.WriteLine(vbLf & “>>> VB.Net Program to print Numbers 1..n as Right Triangle <<<“)
        Console.Write(vbLf & ” Enter the nth number of series: “)
        n = Convert.ToInt32(Console.ReadLine()) ‘taking input, converting to Int
        For i = 1 To n
            For k = 1 To i
                Console.Write(“{0} “, k)
            Next
            Console.Write(vbLf)
        Next
        Console.ReadLine()
    End Sub
End Module

Sample output Screen :

VB.Net-Print-Right-Triangle

Leave a Reply

Your email address will not be published. Required fields are marked *