473,513 Members | 2,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Nov 20 '05 #1
16 1426

"wilfredo perez" <an*******@discussions.microsoft.com> wrote in message
news:c2****************************@phx.gbl...
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
Nov 20 '05 #2
"wilfredo perez" <an*******@discussions.microsoft.com> schrieb
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
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
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
-----Original Message-----

"wilfredo perez" <an*******@discussions.microsoft.com> wrote in messagenews:c2****************************@phx.gbl...
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
.

Nov 20 '05 #4
Cor
> 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

Nov 20 '05 #5
Homework is intended to make *you* think about a problem, not to have other
people solve it for you.

"wilfredo perez" <an*******@discussions.microsoft.com> wrote in message
news:c2****************************@phx.gbl...
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


Nov 20 '05 #6
Cor
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
Homework is intended to make *you* think about a problem, not to have other people solve it for you.

Nov 20 '05 #7
RDI
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*******@freenet.de> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
"wilfredo perez" <an*******@discussions.microsoft.com> schrieb
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
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #8
"RDI" <RD**@writeme.com> schrieb
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?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #9
* "wilfredo perez" <an*******@discussions.microsoft.com> scripsit:
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 [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #10
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb
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

Nov 20 '05 #11
* "Armin Zingler" <az*******@freenet.de> scripsit:
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. ;)


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>
Nov 20 '05 #12
Cor
Herfried,

Did I see it good was it

hi***************@gmx.at

who was writing this or was it a fake?

:-))

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

Nov 20 '05 #13
* "Cor" <no*@non.com> scripsit:
Did I see it good was it

hi***************@gmx.at

who was writing this or was it a fake?


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

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #14
I needed help not my homework done.So I can understand the
code
-----Original Message-----
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
Homework is intended to make *you* think about a
problem, not to haveother
people solve it for you.

.

Nov 20 '05 #15
Cor
Hi Herfried,
who was writing this or was it a fake?


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


I doubt it because that one would write OT before this kind of messages he
said

:-)))))))))))))))

Cor
Nov 20 '05 #16
* "Cor" <no*@non.com> scripsit:
who was writing this or was it a fake?


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


I doubt it because that one would write OT before this kind of messages he
said


I am not perfect too.

;-)))

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2757
by: Brian | last post by:
I'm diddlying with a script, and found some behavior I don't understand. Take this snippet: for ($i = 0; $i <= count($m); $i++) { array_shift($m); reset($m); }
2
575
by: Stormkid | last post by:
Hi Group I'm trying to figure out a way that I can take two (two dimensional) arrays and avShed and shed, and subtract the matching elements in shed from avShed I've pasted the arrays blow from a...
15
5156
by: lawrence | last post by:
I wanted to test xml_parse_into_struct() so I took the example off of www.php.net and put this code up on a site: <?php $simple = <<<END <item>
8
3465
by: vcardillo | last post by:
Hello all, Okay, I am having some troubles. What I am doing here is dealing with an employee hierarchy that is stored in an array. It looks like this: $employees = array( "user_id" => array(...
12
55528
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
8
10199
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when...
58
10050
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
104
16852
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
7
3168
by: Jim Carlock | last post by:
Looking for suggestions on how to handle bad words that might get passed in through $_GET variables. My first thoughts included using str_replace() to strip out such content, but then one ends...
17
7211
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
0
7160
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7537
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7099
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3233
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1594
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
456
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.