This website completely moved to new platform. For latest content, visit www.programmingposts.com

Search this Site

29 Nov 2014

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

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 :