array

  • Thread starter Thread starter wilfredo perez
  • Start date Start date
W

wilfredo perez

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
 
wilfredo perez said:
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

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

David
 
wilfredo perez said:
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

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
 
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
 
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
For i As Integer = 1 To 50
Dim s As New System.Text.StringBuilder
Dim y As Integer
Dim x As Integer = i
For y = 0 To i - 1
s.Append(x.ToString)
x += 1
Next
Me.ListBox1.Items.Add(s.ToString)
Next
 
Homework is intended to make *you* think about a problem, not to have other
people solve it for you.
 
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
 
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
 
RDI said:
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

Are you referring to my answer or to Wilfredo's question?
 
* "wilfredo perez said:
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.

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 said:
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.

Yes, he will ignore all the answers. ;)
 
* "Armin Zingler said:
Yes, he will ignore all the answers. ;)

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

Did I see it good was it

(e-mail address removed)

who was writing this or was it a fake?

:-))
 
* "Cor said:
Did I see it good was it

(e-mail address removed)

who was writing this or was it a fake?

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

;-)
 
Back
Top