Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Public Class Form1 Dim batas As String Dim x, y, z As Integer Sub inputbatas() batas = Val(TextBox1.

Text) If batas = "" Then MsgBox("Anda belum memasukkan inputbatas() End If End Sub Sub inputbatas2() batas = Val(TextBox2.Text) If batas = "" Then MsgBox("Anda belum memasukkan inputbatas2() End If End Sub Sub inputbatas3() batas = Val(TextBox3.Text) If batas = "" Then MsgBox("Anda belum memasukkan inputbatas3() End If End Sub Sub inputbatas4() batas = Val(TextBox4.Text) If batas = "" Then MsgBox("Anda belum memasukkan inputbatas4() End If End Sub

batas", , "Pesan")

batas", , "Pesan")

batas", , "Pesan")

batas", , "Pesan")

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ListBox1.Items.Clear() inputbatas() If CInt(batas) < 1 Then ListBox1.Items.Add("Tidak ada bilangan Fibonaci kurang dari 1") Else x = 1 y = 0 z = 1 Do Until x >= CInt(batas) ListBox1.Items.Add(x) x = y + z y = z z = x Loop End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" ListBox1.Items.Clear() End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ListBox2.Items.Clear() inputbatas2() If CInt(batas) < 1 Then ListBox2.Items.Add("Tidak ada bilangan Fibonaci kurang dari 1") Else x = 1 y = 0 z = 1 Do ListBox2.Items.Add(x) x = y + z y = z z = x Loop Until x >= CInt(batas) End If End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click TextBox2.Text = "" ListBox2.Items.Clear() End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click ListBox3.Items.Clear() inputbatas3() If CInt(batas) < 1 Then ListBox3.Items.Add("Tidak ada bilangan Fibonaci kurang dari 1") Else x = 1 y = 0 z = 1 Do While x < CInt(batas) ListBox3.Items.Add(x) x = y + z y = z z = x Loop End If End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click TextBox3.Text = "" ListBox3.Items.Clear() End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click ListBox4.Items.Clear() inputbatas4() If CInt(batas) < 1 Then

Else

ListBox4.Items.Add("Tidak ada bilangan Fibonaci kurang dari 1")

x = 1 y = 0 z = 1 Do ListBox4.Items.Add(x) x = y + z y = z z = x Loop While x < CInt(batas) End If End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click TextBox4.Text = "" ListBox4.Items.Clear() End Sub End Class

You might also like