Monday, September 21, 2015

PRINT STAR PATTERN IN VB.NET USING NESTED FOR LOOP


Above pattern print program is given below -

Dim row, col, noofrow, noofcol As Integer
        noofrow = 15
        For row = 1 To noofrow
            For col = 1 To row
                Console.Write("*")
            Next
            Console.Write(vbNewLine)
        Next
        noofrow = 14 : noofcol = noofrow
        For row = 1 To noofrow
            For col = 1 To noofcol
                Console.Write("*")
            Next
            Console.Write(vbNewLine)
            noofcol -= 1
        Next

0 comments:

Post a Comment