Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim answer As Integer
Dim capital, rate, money, year As Single
capital = Val(TextBox1.Text)
rate = Val(TextBox2.Text) / 100
money = Val(TextBox3.Text)
year = 0
Do
year = year + 1
capital = capital * (1 + rate)
Loop Until capital >= money
answer = MsgBox("要努力存" & year & "年,才有" & capital & "元。", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "複利")
End Sub
End Class
沒有留言:
張貼留言