Latihan visual basic 2010/Looping/Perulangan

6,529 views
6,117 views

Published on

Looping

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,529
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
175
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Latihan visual basic 2010/Looping/Perulangan

  1. 1. Latihan Visual Basic 2010 Disusun oleh: Nurul Arhaiyyu 1113000003 Jurusan: Sistem InformasiAsian Banking FinanceAnd Informatics Institute ABFI INSTITUTE PERBANAS
  2. 2. PROGRAM PANGKAT
  3. 3. Source Code: Private Sub Button2_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs)Handles Button2.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox1.Focus() End Sub Private Sub Button3_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs)Handles Button3.Click Close() End Sub Private Sub Button1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs)Handles Button1.Click Dim nilai As Integer Dim pangkat As Integer Dim i As Integer Dim jumlah As Integer nilai = Val(TextBox1.Text) pangkat = Val(TextBox2.Text) jumlah = 1 For i = 1 To pangkat jumlah = jumlah * nilai Next TextBox3.Text = jumlah End Sub Private Sub Button4_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs)Handles Button4.Click Form1.Show() End SubEnd Class
  4. 4. PROGRAM PERULANGAN PENJ
  5. 5. PENJELASAN:AWAL: 1AKHIR: 5HASIL: 15Nilai awal+Nilai akhir tetapi secaraperulanganArtinya 1+2+3+4+5 = 15
  6. 6. Source Code: Private Sub Button3_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs)Handles Button3.Click Close() End Sub Private Sub Button2_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs)Handles Button2.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox1.Focus() End Sub Private Sub Button1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs)Handles Button1.Click Dim jumlah As Integer Dim awal As Integer Dim akhir As Integer Dim i As Integer awal = Val(TextBox1.Text) akhir = Val(TextBox2.Text) For i = awal To akhir jumlah = jumlah + i Next TextBox3.Text = jumlah End Sub Private Sub Button4_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs)Handles Button4.Click Form2.Show() End SubEnd Class

×