![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2005
Posts: 3
Rep Power: 0
![]() |
nested loops in vb
Hi, im relatively new to programming, im only doing a module on it at uni but im struggling with the basic concept of nested loops! I need to create just a console application that displays;
**********10 *********9 ********8 *******7 ******6 *****5 ****4 ***3 **2 *1 Although i can create the 10 to one list easily and im struggling with the *'s and especially combining them. Anyone got any ideas! Cheers |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
well the easyest way to do ti would be to use two for loops. like this:
for x = 0 to 9 step 1
for y = 0 to x step 1
output only one * here the loops will do the rest.
Next y
Next xall though that code will print them like this: * ** *** **** ***** ****** ******* ******** ********* ********** so i'll let you figure out the rest, since this is a homework question.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Mar 2005
Posts: 3
Rep Power: 0
![]() |
Thanks for your help, it set me on the right track, figured the rest out for myself;
For i = 10 To 1 Step -1 For y = 1 To i Step +1 Console.Write("*") Next y Console.WriteLine(i) Next i Console.ReadLine() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|