2007-12-13 09:22:18,,飛ㄦ*

圓面積的計算

Module Module1

Sub Main()
Dim r1 As Single
Dim R2 As Single
Dim B As String

Console.Write(”請輸第一個圓的半徑:”)
r1 = Console.ReadLine
Console.Write(”請輸第二個圓的半徑:”)
R2 = Console.ReadLine
If r1 > R2 Then
B = area(r1) - AREA(R2)
Else
B = area(R2) - AREA(r1)
End If
Console.Write(”第一個圓的面積為:” & AREA(r1))
Console.WriteLine()
Console.Write(”第一個圓的面積為:” & AREA(R2))
Console.WriteLine()
Console.Write(”兩圓所為成的面積為:” & B)
Console.WriteLine()
MySub()
End Sub

Function AREA(ByVal R As Single) As Double
Dim A As Single
A = R * R * 3.14159
Return A
End Function

Sub MySub()
Console.WriteLine()
Console.Write(”請按一下程式繼續執行”)
Console.ReadKey()

End Sub

End Module

上一篇:BMI的計算

下一篇:販賣機