2008年11月11日 星期二

巢狀迴路練習題 6題

image


Module Module1
Dim j, i, k
Sub Main()
'
For i = 1 To 5
For j = 1 To i
Console.Write("●")
Next
Console.WriteLine()
Next
Console.WriteLine()

'
For i = 5 To 1 Step -1
For j = 1 To i
Console.Write("●")
Next
Console.WriteLine()
Next
Console.WriteLine()

'
For i = 1 To 5
For k = 5 - i To 1 Step -1
Console.Write(" ")
Next
For j = 1 To i
Console.Write("●")
Next
Console.WriteLine()
Next
Console.WriteLine()

'
For i = 5 To 1 Step -1
For k = 5 - i To 1 Step -1

Console.Write(" ")
Next
For j = 1 To i
Console.Write("●")
Next
Console.WriteLine()
Next
Console.WriteLine()

'
For i = 1 To 5
For k = 5 - i To 1 Step -1
Console.Write(" ")
Next
For j = 1 To i
Console.Write("●")
Next
Console.WriteLine()
Next
Console.WriteLine()

'
For i = 5 To 1 Step -1
For k = 5 - i To 1 Step -1
Console.Write(" ")
Next
For j = 1 To i
Console.Write("●")
Next
Console.WriteLine()
Next
Console.WriteLine()
Console.Read()
End Sub

End Module

沒有留言: