Pages

Search This Blog

Floyd's Triangle


Module floyds_tri
    Sub Main()
        Dim i, j, s, n As Integer
        Console.Write("Enter the number of lines:")
        n = CInt(Console.ReadLine())
        s = 1
        For i = 1 To n
            For j = 1 To i
                Console.Write(s & " ")
                s += 1
            Next

            Console.WriteLine()
        Next
        Console.ReadLine()
    End Sub
End Module
Output
1
2  3
4  5  6
7  8  9  10
11 12 13 14 15

3 comments:

  1. how you can i get this kind of output


    1
    2 4
    3 6 9
    4 8 12 16
    5 10 15 20 25

    thnxs for your response

    ReplyDelete
  2. Very informative article.Thank you author for posting this kind of article .


    http://www.wikitechy.com/view-article/java-program-to-print-floyds-triangle-example



    Both are really good,
    Cheers,
    Venkat

    ReplyDelete
  3. This is very Good Information Thanku For Sharing This Information.
    Dot Net Online Training
    Visit us: Dot Net Online Training

    ReplyDelete