Presentation is loading. Please wait.

Presentation is loading. Please wait.

Nested Loops. For i = 1 To 5 For j = 1 To 6 picOutput.Print "*"; Next j picOutput.Print Next i.

Similar presentations


Presentation on theme: "Nested Loops. For i = 1 To 5 For j = 1 To 6 picOutput.Print "*"; Next j picOutput.Print Next i."— Presentation transcript:

1 Nested Loops

2 For i = 1 To 5 For j = 1 To 6 picOutput.Print "*"; Next j picOutput.Print Next i

3 ******

4 For i = 1 To 5 For j = 1 To 6 picOutput.Print "*" Next j picOutput.Print Next i

5 ************************************************************

6 For i = 1 To 5 For j = 1 To 6 picOutput.Print "*"; Next j picOutput.Print; Next i

7 ******************************

8 For i = 1 To 5 For j = 1 To 6 picOutput.Print tab(j);"*"; Next j picOutput.Print Next i

9 ******

10 For i = 1 To 5 For j = 1 To 6 picOutput.Print tab(j);"*" Next j picOutput.Print Next i

11 *

12 For i = 1 To 5 For j = 1 To 6 picOutput.Print tab(2*j);“*”; Next j picOutput.Print Next i

13 * * * * * *

14 For i = 1 To 5 For j = 1 To 6 picOutput.Print tab(2*j);“*”; Next j picOutput.Print; Next i

15 * * * * * *

16 For i = 1 To 5 For j = 1 To 6 picOutput.Print tab(i);“*”; Next j picOutput.Print Next i

17 *

18 For i = 1 To 5 For j = 1 To 6 picOutput.Print tab(i*j);“*”; Next j picOutput.Print; Next i

19 ******

20 For i = 1 To 5 For j = 1 To 6 If(i<j) Then picOutput.Print “*”; End If Next j picOutput.Print Next i

21 ***** **** *** ** *

22 For i = 1 To 5 For j = 1 To 6 If(i<=j) Then picOutput.Print “*”; End If Next j picOutput.Print Next i

23 ****** ***** **** *** **

24 For i = 1 To 5 For j = 1 To 6 If(i>=j) Then picOutput.Print “*”; End If Next j picOutput.Print; Next i

25 * ** *** **** *****

26 star = "*" For i = 1 To 5 picOutput.Print star star = star & "*" Next i

27 * ** *** **** *****

28 For i = 1 To 5 For j = 1 To 6 If(i=j) Then picOutput.Print “*”; Else picOutput.Print “#”; End If Next j picOutput.Print Next i

29 *##### #*#### ##*### ###*## ####*#

30 For i = 1 To 5 For j = 1 To 6 picOutput.Print "*"; Next j For k = 1 To 3 picOutput.Print "#"; Next k picOutput.Print Next i

31 ******###

32 For i = 1 To 5 For j = 1 To 6 picOutput.Print "*"; For k = 1 To 3 picOutput.Print "#"; Next k Next j picOutput.Print Next i

33 *###*###*###*###*###*###

34 size=6 For i = 1 To size picOutput.Print "*"; Next i picOutput.Print For i = 1 To size - 2 picOutput.Print "*"; For j = 1 To size - 2 picOutput.Print " "; Next j picOutput.Print "*" Next i For i = 1 To size picOutput.Print "*"; Next i

35 ****** * ******

36 Size = 6 For i = 1 To Size For j = 1 To Size If (i = 1 Or i = Size) Then picOutput.Print "*"; ElseIf (j > 1 And j < Size) Then picOutput.Print " "; Else picOutput.Print "*"; End If Next j picOutput.Print Next i

37 Syntax error For i = 1 To 5 For j = 1 To 6 picOutput.Print "*"; Next i picOutput.Print Next j

38 Correct!, but hard to read! For i = 1 To 5 For j = 1 To 6 picOutput.Print "*"; Next j picOutput.Print Next i


Download ppt "Nested Loops. For i = 1 To 5 For j = 1 To 6 picOutput.Print "*"; Next j picOutput.Print Next i."

Similar presentations


Ads by Google