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 16 1439
"wilfredo perez" <an*******@disc ussions.microso ft.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
"wilfredo perez" <an*******@disc ussions.microso ft.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
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*******@disc ussions.microso ft.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
.
> 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.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
Homework is intended to make *you* think about a problem, not to have other
people solve it for you.
"wilfredo perez" <an*******@disc ussions.microso ft.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
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.
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*******@free net.de> wrote in message
news:ed******** ******@TK2MSFTN GP09.phx.gbl... "wilfredo perez" <an*******@disc ussions.microso ft.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
* "wilfredo perez" <an*******@disc ussions.microso ft.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> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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);
}
|
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 print_r cmd any
suggestions would be great. Thanks much Todd
//avShed array
Array ( => Array ( => 1 => 08:00 ) => Array
( => 1 => 08:05 ) ...
|
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>
|
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( "name", "title",
"reports to user id", "start date in the format: mm/dd/yyyy" )
);
How can I display this hierarchy in simple nested <li> tags in...
|
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 also removed)
So far I have (val is value, ar is array, returns new array):
| |
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 it is assigned a text
literal?? HOW can I change the array value to upper case then? What other
method exists for arrays?
Ex:
var GridArrayName1...
|
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 code...
TCHAR myArray;
DoStuff(myArray);
|
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 that array
Could you show me a little example how to do this?
Thanks.
|
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 up looking for characters that wrap
around the stripped characters and it ends up as a recursive
ordeal that fails to identify a poorly constructed...
|
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 to show the array data to the end user.
Can I do that?
How?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 we have to send another system
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |