Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer = InputBox("")
Dim j As Integer = InputBox("")
Dim k As Integer = InputBox("")
MsgBox(area1(i))
MsgBox(area1(j, i))
MsgBox(area1(k, j, i))
End Sub
Function area1(ByVal a As Integer)
Dim ans As Single
ans = Math.PI * (Math.Pow(a, 2))
Return ans
End Function
Function area1(ByVal a As Integer, ByVal b As Integer)
Dim ans As Integer
ans = a * b
Return ans
End Function
Function area1(ByVal a As Integer, ByVal b As Integer, ByVal c As Integer)
Dim ans As Single
ans = ((c + b) * a) / 2
Return ans
End Function
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i As Integer = InputBox("")
MsgBox(power(2, i))
End Sub
Function power(ByVal a As Integer, ByVal b As Integer)
Dim ans As String = "1"
Dim j As Integer
For j = 1 To b
ans = ans & "+ " & a & "^" & j
Next
Return ans
End Function |