Rabu, 26 September 2012

VISUAL BASIC deret,faktorial,dan lingkaran

deret
Private Sub Form_Activate()
i = 0
Do
i = i + 1
Print i * i;
Loop While i <= 5
End Sub
****************************************
faktorial
Private Sub Form_Activate()
i = 1
fact = 1
Do While i <= 5
    Print fact;
    i = i + 1
    fact = fact * i
Loop
End Sub
***************************************
lingkaran
Private Sub Form_Activate()
Dim luas, keliling, jari2
Const PI = 3.14
r = InputBox("masukkan jari-jari:")
k = 2 * PI * r
l = PI * r * r
Print "keliling:"; k
Print "luas:"; l
End Sub

Tidak ada komentar:

Posting Komentar