Latihan visual basic 2010/Looping/Perulangan

  • 3,459 views
Uploaded on

Looping

Looping

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,459
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
100
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Latihan Visual Basic 2010 Disusun oleh: Nurul Arhaiyyu 1113000003 Jurusan: Sistem InformasiAsian Banking FinanceAnd Informatics Institute ABFI INSTITUTE PERBANAS
  • 2. PROGRAM PANGKAT
  • 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. PROGRAM PERULANGAN PENJ
  • 5. PENJELASAN:AWAL: 1AKHIR: 5HASIL: 15Nilai awal+Nilai akhir tetapi secaraperulanganArtinya 1+2+3+4+5 = 15
  • 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