English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need a simple program with "nested loops"
Umm...please put in a nested looped program which I can edit and improve... But please, no programs such as:

1
22
333
4444
55555

...because thats the very basic...I need a program which can be used by other people but has nested loops..but easy to do..
thanks....Ü

2007-01-13 16:55:54 · 1 answers · asked by Jed Stephen 3 in Computers & Internet Programming & Design

1 answers

What you have there isn't a nested loop. You do it with 5 different loops that aren't nested:

For A = 1 To 1
Console.Write("1")
Next
Console.Write(vbCrLf)
For A = 1 To 2
Console.Write("2")
Next
Console.Write(vbCrLf)
For A = 1 To 3
Console.Write("3")
Next
Console.Write(vbCrLf)
For A = 1 To 4
Console.Write("4")
Next
Console.Write(vbCrLf)
For A = 1 To 5
Console.Write("5")
Next
Console.Write(vbCrLf)

The following IS a nested loop:

For A = 1 To 5
strOut = "This is A loop no. " & A
For B = 1 To 10
strOut += " and B loop no. " & B & vbCrLf
Next
Console.Write(strOut)
Next

2007-01-13 17:41:45 · answer #1 · answered by Anonymous · 0 0

fedest.com, questions and answers