Monday, September 21, 2015

PRINT STAR PATTERN IN VB.NET USING NESTED FOR LOOP

Above pattern print program is given below -

 Dim row, col, colspace, noofrow As Integer
        noofrow = 20
        For row = 1 To noofrow Step 1
            For colspace = noofrow - row To 1 Step -1
                Console.Write(" ")
            Next
            For col = 1 To row Step 1
                Console.Write("* ")
            Next
            Console.Write(vbNewLine)
        Next
        For row = 1 To 6 Step 1
            For colspace = 1 To noofrow - 1 Step 1
                Console.Write(" ")
            Next
            For col = 1 To 2 Step 1
                Console.Write("*")
            Next
            Console.Write(vbNewLine)
        Next

0 comments:

Post a Comment