Pages

Search This Blog

Number Triangle 1


Module numbers_1

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

End Module
Output
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

41 comments:

  1. misalkan dirubah jadi gini gan. gimana syntaxnya?

    1
    2 3
    4 5 6
    7 8 9 10

    thx gan

    ReplyDelete
    Replies
    1. Sub Main()
      Dim i, j, n As Integer
      Dim k = 1
      Console.Write("Enter the number of lines:")
      n = CInt(Console.ReadLine())
      For i = 1 To n
      For j = 1 To i
      Console.Write(k & " ")
      k = k +1
      Next
      Console.WriteLine()
      Next
      Console.ReadLine()
      End Sub

      Delete
  2. Console a command prompt like screen.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. it should be like below where .. are replaced by " "
    ......1
    .....121
    ....12321
    ...1234321
    ..123454321

    ReplyDelete
    Replies
    1. Private Sub Command1_Click()
      Dim A As Integer
      Dim B As Integer
      Dim X As Integer
      Dim OSP As Integer
      Dim Z As Integer
      Z = 5
      X = 1
      For A = 1 To 3
      For OSP = 1 To Z
      Print ".";
      Next OSP
      Z = Z - 2
      Print X * X;
      X = X * 10 + 1
      Print
      Next A
      End Sub

      MORE THAN 3 LINES ARE OVERFLOWING

      Delete
  5. it should be like below where .. are replaced by " "
    ......1
    .....121
    ....12321
    ...1234321
    ..123454321

    I have managed to print this sequence instead

    1
    121
    1231
    1234321
    123454321

    ReplyDelete
  6. solution to the problem
    Imports System.Math
    Module Module1

    Sub Main()
    Dim i As Integer
    Dim k As Char
    Dim l As Integer
    Dim b As Integer
    Dim a As Integer = 1
    Dim s As Integer = 1
    k = ""
    Dim c As Integer
    c = 5
    l = c
    For i = 0 To l + 1
    Console.Write(" ")
    Next
    Console.Write(1)
    Console.WriteLine()
    For a = 1 To c
    If l > 0 Then
    For i = 0 To l
    Console.Write(" ")
    Next
    'Console.WriteLine()
    l = l - 1
    End If
    s = s * 10 + 1
    'Console.Write(i)
    For b = c - a To b >= 1
    b = b - 1
    Console.WriteLine()
    Next

    Console.Write(CLng(Pow(s, 2)))
    Console.WriteLine()
    Next
    Console.ReadLine()
    End Sub

    End Module

    ReplyDelete
  7. 2
    4 6
    8 10 12
    plz give a solution

    ReplyDelete
  8. nice, but how i do this for windows form not console apps

    ReplyDelete
  9. nice, but how could i do this for windows form apps not console apps... I need help to solve this

    ReplyDelete

  10. Good Post! Thank you so much for sharing this pretty post,
    it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Java training in Chennai

    Java training in Bangalore

    Java online training

    Java training in Pune

    ReplyDelete
  11. please help me with

    15 15 15

    14 14

    13

    ReplyDelete
  12. 654321
    54321
    4321
    321
    21
    1
    please help create piramid

    ReplyDelete
  13. can u help me to make this shape

    H
    HE
    HEL
    HELL
    HELLO
    HELL
    HEL
    HE
    H

    ReplyDelete
  14. How about this.
    The output like this
    **********
    *********
    ********
    *******
    ******
    *****
    ****
    ***
    **
    *
    Cn you help me?

    ReplyDelete
    Replies
    1. Module Module1
      'Rufaro Sitotombe
      'lower six
      Sub Main()


      Dim i As Integer
      Dim j As Integer
      ' the asterics that are going to be displayed
      For j = 1 To 5

      For i = j To 5

      Console.Write(" *")

      Next i
      Console.WriteLine()
      Next j
      ' to display the output
      Console.ReadLine()

      End Sub

      End Module

      Delete
    2. ndobva ndanzwa kuti ndikudzidzisa apa stots

      Delete
    3. ukutii koiwe

      Delete
    4. taura hako ndokuti vb ukuk

      Delete
  15. *
    * *
    * * * *
    * * * * * *

    cn u rply me this output coding

    ReplyDelete
  16. hi, everyone
    how i can do this output coding?
    *****
    ****
    ***
    **
    *

    or this,

    *
    **
    ***
    ****
    *****

    ReplyDelete
    Replies
    1. i want to particapate the code wich you make

      Delete
    2. Imports System
      Module Module1
      Sub Main()
      Dim i, j As Integer
      For i = 3 To 1 Step -1
      For j = 1 To i
      Console.Write("* ")
      Next
      Console.WriteLine("")
      Next
      Console.ReadKey()
      End Sub
      End Module


      REPLACE VALUE OF i, which is 3 here to number of rows you need

      Delete
  17. hi, everyone
    how i can do this output coding?
    *****
    ****
    ***
    **
    *

    or this,

    *
    **
    ***
    ****
    *****

    Reply

    ReplyDelete
    Replies
    1. pardon my wrong send, the output should be the other side

      Delete
  18. Help me ..I want something of this sort
    1
    12
    123
    1234
    12345
    123456

    ReplyDelete
  19. develop a VB.NET console application to display the following pattern
    *
    ***
    *****

    ReplyDelete
  20. Replies
    1. Write a console application to print the following pattern.
      1
      2 3
      4 5 6
      7 8 9 10

      Delete