array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • wilfredo perez

    array

    I need to come up with a code to display 1 to 50 like this:
    1
    2 3
    3 4 5
    4 5 6 7
    until 50
    Can someone show me or start me off with how to come up
    with the code.
    Thanks
  • David Browne

    #2
    Re: array


    "wilfredo perez" <anonymous@disc ussions.microso ft.com> wrote in message
    news:c22c01c3b9 b9$c6cfa090$a60 1280a@phx.gbl.. .[color=blue]
    > I need to come up with a code to display 1 to 50 like this:
    > 1
    > 2 3
    > 3 4 5
    > 4 5 6 7
    > until 50
    > Can someone show me or start me off with how to come up
    > with the code.
    > Thanks[/color]

    for i as integer = 1 to 50
    for j as integer = 1 to i
    . . .
    next
    next

    David


    Comment

    • Armin Zingler

      #3
      Re: array

      "wilfredo perez" <anonymous@disc ussions.microso ft.com> schrieb[color=blue]
      > I need to come up with a code to display 1 to 50 like this:
      > 1
      > 2 3
      > 3 4 5
      > 4 5 6 7
      > until 50
      > Can someone show me or start me off with how to come up
      > with the code.
      > Thanks[/color]

      dim i, j as integer

      for i=1 to 50
      for j = 1 to i
      debug.write j
      debug.write " "
      next j
      debug.writeline ""
      next i


      --
      Armin




      Comment

      • Patrick Ireland

        #4
        Re: array

        Imports System.Console
        Module TestForLoop
        Sub Main()
        Dim intStart As Integer = 1
        Dim intValue As Integer = intStart
        Dim intOuter As Integer
        Dim intInner As Integer
        For intOuter = 1 To 50
        For intInner = 1 To intOuter
        Write("{0}", intValue)
        intValue += 1
        Next intInner
        WriteLine("")
        intStart += 1
        intValue = intStart
        Next intOuter
        End Sub
        End Module


        [color=blue]
        >-----Original Message-----
        >
        >"wilfredo perez" <anonymous@disc ussions.microso ft.com>[/color]
        wrote in message[color=blue]
        >news:c22c01c3b 9b9$c6cfa090$a6 01280a@phx.gbl. ..[color=green]
        >> I need to come up with a code to display 1 to 50 like[/color][/color]
        this:[color=blue][color=green]
        >> 1
        >> 2 3
        >> 3 4 5
        >> 4 5 6 7
        >> until 50
        >> Can someone show me or start me off with how to come up
        >> with the code.
        >> Thanks[/color]
        >
        >for i as integer = 1 to 50
        > for j as integer = 1 to i
        > . . .
        > next
        >next
        >
        >David
        >
        >
        >.
        >[/color]

        Comment

        • Cor

          #5
          Re: array

          > I need to come up with a code to display 1 to 50 like this:[color=blue]
          > 1
          > 2 3
          > 3 4 5
          > 4 5 6 7
          > until 50[/color]
          For i As Integer = 1 To 50
          Dim s As New System.Text.Str ingBuilder
          Dim y As Integer
          Dim x As Integer = i
          For y = 0 To i - 1
          s.Append(x.ToSt ring)
          x += 1
          Next
          Me.ListBox1.Ite ms.Add(s.ToStri ng)
          Next



          Comment

          • Jeremy Cowles

            #6
            Re: array

            Homework is intended to make *you* think about a problem, not to have other
            people solve it for you.



            "wilfredo perez" <anonymous@disc ussions.microso ft.com> wrote in message
            news:c22c01c3b9 b9$c6cfa090$a60 1280a@phx.gbl.. .[color=blue]
            > I need to come up with a code to display 1 to 50 like this:
            > 1
            > 2 3
            > 3 4 5
            > 4 5 6 7
            > until 50
            > Can someone show me or start me off with how to come up
            > with the code.
            > Thanks
            >[/color]

            Comment

            • Cor

              #7
              OT: Re: array

              Hi Jeremy,

              I was thinking the same, therefore I made something from what I did thougth
              "when he looks at it he has more homework than making his homework"

              :-))

              Cor[color=blue]
              > Homework is intended to make *you* think about a problem, not to have[/color]
              other[color=blue]
              > people solve it for you.[/color]


              Comment

              • RDI

                #8
                Re: array

                dim i, j, k as integer
                j=2
                debug.write 1
                debug.write " "
                for i=3 to 50
                k = j
                for j = k to i
                debug.write j
                debug.write " "
                next j
                debug.writeline ""
                next i

                "Armin Zingler" <az.nospam@free net.de> wrote in message
                news:edKvM2buDH A.1224@TK2MSFTN GP09.phx.gbl...[color=blue]
                > "wilfredo perez" <anonymous@disc ussions.microso ft.com> schrieb[color=green]
                > > I need to come up with a code to display 1 to 50 like this:
                > > 1
                > > 2 3
                > > 3 4 5
                > > 4 5 6 7
                > > until 50
                > > Can someone show me or start me off with how to come up
                > > with the code.
                > > Thanks[/color]
                >
                > dim i, j as integer
                >
                > for i=1 to 50
                > for j = 1 to i
                > debug.write j
                > debug.write " "
                > next j
                > debug.writeline ""
                > next i
                >
                >
                > --
                > Armin
                >
                > http://www.plig.net/nnq/nquote.html
                > http://www.netmeister.org/news/learn2quote.html
                >[/color]


                Comment

                • Armin Zingler

                  #9
                  Re: array

                  "RDI" <RDI!@writeme.c om> schrieb[color=blue]
                  > dim i, j, k as integer
                  > j=2
                  > debug.write 1
                  > debug.write " "
                  > for i=3 to 50
                  > k = j
                  > for j = k to i
                  > debug.write j
                  > debug.write " "
                  > next j
                  > debug.writeline ""
                  > next i[/color]

                  Are you referring to my answer or to Wilfredo's question?


                  --
                  Armin




                  Comment

                  • Herfried K. Wagner [MVP]

                    #10
                    Re: array

                    * "wilfredo perez" <anonymous@disc ussions.microso ft.com> scripsit:[color=blue]
                    > I need to come up with a code to display 1 to 50 like this:
                    > 1
                    > 2 3
                    > 3 4 5
                    > 4 5 6 7
                    > until 50
                    > Can someone show me or start me off with how to come up
                    > with the code.[/color]

                    I won't do your homework, but what's your problem? Have a look at the
                    'For...To' loop. I am sure you will be able to solve the problem on
                    your own.

                    --
                    Herfried K. Wagner [MVP]
                    <http://www.mvps.org/dotnet>

                    Comment

                    • Armin Zingler

                      #11
                      Re: array

                      "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schrieb[color=blue]
                      > I won't do your homework, but what's your problem? Have a look at
                      > the 'For...To' loop. I am sure you will be able to solve the problem
                      > on your own.[/color]

                      Yes, he will ignore all the answers. ;)


                      --
                      Armin

                      Comment

                      • Herfried K. Wagner [MVP]

                        #12
                        Re: array

                        * "Armin Zingler" <az.nospam@free net.de> scripsit:[color=blue][color=green]
                        >> I won't do your homework, but what's your problem? Have a look at
                        >> the 'For...To' loop. I am sure you will be able to solve the problem
                        >> on your own.[/color]
                        >
                        > Yes, he will ignore all the answers. ;)[/color]

                        Now I am seeing them. A shame that the msnews server doesn't support
                        cancel messages.

                        --
                        Herfried K. Wagner [MVP]
                        <http://www.mvps.org/dotnet>

                        Comment

                        • Cor

                          #13
                          OT: Re: array

                          Herfried,

                          Did I see it good was it

                          hirf-spam-me-here@gmx.at

                          who was writing this or was it a fake?

                          :-))
                          [color=blue]
                          >
                          > Now I am seeing them. A shame that the msnews server doesn't support
                          > cancel messages.[/color]


                          Comment

                          • Herfried K. Wagner [MVP]

                            #14
                            Re: OT: Re: array

                            * "Cor" <non@non.com> scripsit:[color=blue]
                            > Did I see it good was it
                            >
                            > hirf-spam-me-here@gmx.at
                            >
                            > who was writing this or was it a fake?[/color]

                            No, that's not a fake. That's HKW, the original.

                            ;-)

                            --
                            Herfried K. Wagner [MVP]
                            <http://www.mvps.org/dotnet>

                            Comment

                            • Wilfredo Perez

                              #15
                              OT: Re: array

                              I needed help not my homework done.So I can understand the
                              code[color=blue]
                              >-----Original Message-----
                              >Hi Jeremy,
                              >
                              >I was thinking the same, therefore I made something from[/color]
                              what I did thougth[color=blue]
                              >"when he looks at it he has more homework than making his[/color]
                              homework"[color=blue]
                              >
                              >:-))
                              >
                              >Cor[color=green]
                              >> Homework is intended to make *you* think about a[/color][/color]
                              problem, not to have[color=blue]
                              >other[color=green]
                              >> people solve it for you.[/color]
                              >
                              >
                              >.
                              >[/color]

                              Comment

                              Working...