Sabtu, 10 Maret 2012

Membuat Program menghitung Luas Lingkaran, Mencari jumlah dan Rata-rata suatu nilai

Private Sub Command1_Click()
Dim luas, keliling As Single
Dim r As Single
Const phi As Single = 3.14
r = Text1.Text
luas = phi * r * r
keliling = 2 * phi * r
Text2.Text = luas
Text3.Text = keliling
End Sub

Private Sub Command2_Click()
Dim nilai1 As Single
Dim nilai2 As Single
Dim nilai3 As Single
Dim jml As Single
Dim rata2 As Single

nilai1 = Text4.Text
nilai2 = Text5.Text
nilai3 = Text6.Text
jml = nilai1 + nilai2 + nilai3
rata2 = jml / 3
Text7.Text = jml
Text8.Text = rata2
End Sub

0 komentar:

Posting Komentar

 
;