Konversi Bilangan Desimal ke Biner
Berawal dari pelatihan BPC tentang koding IF akhirnya saya berfikiran untuk membuat sebuah program dengan menggunakan materi Mata Kuliah Logika dan Algoritma yang pernah saya pelajari di Semester Satu dulu, kali ini saya mengambil studi kasus pengkonversian dari Bilangan Desimal ke Bilangan Biner.
Private Sub Konfersikan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Konfersikan.Click
If desimal.Text = "0" Then
biner.Text = "0000"
ElseIf desimal.Text = "1" Then
biner.Text = "0001"
ElseIf desimal.Text = "2" Then
biner.Text = "0010"
ElseIf desimal.Text = "3" Then
biner.Text = "0011"
ElseIf desimal.Text = "4" Then
biner.Text = "0100"
ElseIf desimal.Text = "5" Then
biner.Text = "0101"
ElseIf desimal.Text = "6" Then
biner.Text = "0110"
ElseIf desimal.Text = "7" Then
biner.Text = "0111"
ElseIf desimal.Text = "8" Then
biner.Text = "1000"
ElseIf desimal.Text = "9" Then
biner.Text = "1001"
ElseIf desimal.Text = "10" Then
biner.Text = "1010"
ElseIf desimal.Text = "11" Then
biner.Text = "1011"
ElseIf desimal.Text = "12" Then
biner.Text = "1100"
ElseIf desimal.Text = "13" Then
biner.Text = "1101"
ElseIf desimal.Text = "14" Then
biner.Text = "1110"
ElseIf desimal.Text = "15" Then
biner.Text = "1111"
ElseIf desimal.Text = "16" Then
biner.Text = "10000"
End If
End Sub
If desimal.Text = "0" Then
biner.Text = "0000"
ElseIf desimal.Text = "1" Then
biner.Text = "0001"
ElseIf desimal.Text = "2" Then
biner.Text = "0010"
ElseIf desimal.Text = "3" Then
biner.Text = "0011"
ElseIf desimal.Text = "4" Then
biner.Text = "0100"
ElseIf desimal.Text = "5" Then
biner.Text = "0101"
ElseIf desimal.Text = "6" Then
biner.Text = "0110"
ElseIf desimal.Text = "7" Then
biner.Text = "0111"
ElseIf desimal.Text = "8" Then
biner.Text = "1000"
ElseIf desimal.Text = "9" Then
biner.Text = "1001"
ElseIf desimal.Text = "10" Then
biner.Text = "1010"
ElseIf desimal.Text = "11" Then
biner.Text = "1011"
ElseIf desimal.Text = "12" Then
biner.Text = "1100"
ElseIf desimal.Text = "13" Then
biner.Text = "1101"
ElseIf desimal.Text = "14" Then
biner.Text = "1110"
ElseIf desimal.Text = "15" Then
biner.Text = "1111"
ElseIf desimal.Text = "16" Then
biner.Text = "10000"
End If
End Sub
End Class
Semoga Bermanfaat !!!
Semoga Bermanfaat !!!
0 Response to "Konversi Bilangan Desimal ke Biner"
Oops...nggak boleh masukin link aktif disini kak! Mau nyepam ya? Komen dinonaktifkan otomatis oleh Admin Ganteng