Membuat deret pada vb
Buat form seperti berikut
klik 2 kali pada command1
dan masukan seperti berikut
Private Sub Command1_Click()
Dim a, b, c, d, e, f As Integer
For a = 1 To Val(Text1.Text)
For b = 1 To a
Print "*";
Next b
Print
Next a
For c = Val(Text1.Text) - 1 To 1 Step -1
For d = 1 To c
Print "*";
Next d
Print
Next c
End Sub
dan command 2 seperti berikut
Private Sub Command2_Click()
Cls
Text1.Text = ""
End Sub
Misal text box di isi 4
Diagram alur
A.....B...........output
1.....1............1
2.....12.........12
3.....123.......123
4.....1234.....1234
C.....D..........output
3.....123.....123
2.....12........12
1.....1..........1
Jasi hasli output nya
1 namun pada program yang ditampilkan dalam bentuk buntang (“*”)
12
123
1234
123
12
1
Berikut hasil program
Buat form seperti berikut
klik 2 kali pada command1
dan masukan seperti berikut
Private Sub Command1_Click()
Dim a, b, c, d, e, f As Integer
For a = 1 To Val(Text1.Text)
For b = 1 To a
Print "*";
Next b
Next a
For c = Val(Text1.Text) - 1 To 1 Step -1
For d = 1 To c
Print "*";
Next d
Next c
End Sub
dan command 2 seperti berikut
Private Sub Command2_Click()
Cls
Text1.Text = ""
End Sub
Misal text box di isi 4
Diagram alur
A.....B...........output
1.....1............1
2.....12.........12
3.....123.......123
4.....1234.....1234
C.....D..........output
3.....123.....123
2.....12........12
1.....1..........1
Jasi hasli output nya
1 namun pada program yang ditampilkan dalam bentuk buntang (“*”)
12
123
1234
123
12
1
Berikut hasil program
0 komentar:
Posting Komentar