Program mencari luas dan keliling persegi dan lingkaran

Posted by Unknown  |  at  09:40 No comments



Const phi As Double = 3.14
Dim p As Integer
Dim l As Integer
Dim luas_persegi As Double
Dim luas_lingkaran As Double
Dim keliling_lingkaran As Double
Dim keliling_persegi As Double

Private Sub Command1_Click()
If luaspersegi.Value = True Then
p = panjang.Text
l = lebar.Text

luas_persegi = p * l
Label6.Caption = "luas persegi="
Label7.Caption = luas_persegi

Else
p = panjang.Text
l = lebar.Text

keliling_persegi = 2 * (p + l)
Label6.Caption = "keliling persegi="
Label7.Caption = keliling_persegi
End If
End Sub

Private Sub Command2_Click()
If luaslingkaran.Value = True Then
r = txtjari.Text
luas_lingkaran = phi * r * r
Label8.Caption = "luas lingkaran="
Label9.Caption = luas_lingkaran

Else
r = txtjari.Text
keliling_lingkaran = 2 * phi * r
Label8.Caption = "keliling lingkaran="
Label9.Caption = keliling_lingkaran
End If
End Sub

Private Sub Form_Load()
Option1.Value = True
Frame1.Visible = False
Frame2.Visible = False
End Sub

Private Sub Option1_Click()
Frame1.Visible = False
Frame2.Visible = True
End Sub

Private Sub Option2_Click()
Frame1.Visible = True
Frame2.Visible = False
End Sub

Tagged as:

About the Author

Share This Post

Related posts

0 comments:

    Popular Posts

back to top