VB.net 巴斯卡三角型
巴斯卡三角型 超常見的作業題
VB版本的解答好難找,只好自己寫了
Module Module1
Sub Main()
Dim N, P
Dim X As String = ""
Console.Write("請輸入數字 ")
N = Int(Console.ReadLine())
Console.Write(1)
For k = 0 To N
For i = 1 To k
P = 1
For j = 1 To i
P = P * (k - j + 1) / j
Next
X += P & " "
Next
Console.Write(X)
X = "1 "
Console.WriteLine()
Next
Console.ReadLine()
End Sub
End Module
如有錯誤 歡迎指正