Monday, September 21, 2015

PRINT STAR PATTERN IN VB.NET USING NESTED FOR LOOP


Above pattern print program is given below -

  Dim row, col, col1, col2, noofrow, noofcol, colspace As Integer
        noofrow = 25 : noofcol = noofrow : colspace = 0
        For row = 1 To noofrow
            For col = 1 To noofcol
                Console.Write("*")
            Next
            For col1 = 1 To colspace
                Console.Write(" ")
            Next
            For col2 = 1 To noofcol
                Console.Write("*")
            Next
            Console.Write(vbNewLine)
            noofcol -= 1
            colspace += 2
        Next

0 comments:

Post a Comment