Judul : Fungsi Terbilang Visual Basic .NET
link : Fungsi Terbilang Visual Basic .NET
Fungsi Terbilang Visual Basic .NET
Public Function ToTerbilang(ByVal x As Long) As String
Dim abil() As String = {"", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas"}
Dim s As String = ""
If x < 12 Then
s = " " & abil(x)
ElseIf x < 20 Then
s = ToTerbilang(x - 10) & " belas"
ElseIf x < 100 Then
s = ToTerbilang(x \ 10) & " puluh" & ToTerbilang(x Mod 10)
ElseIf x < 200 Then
s = " seratus" & ToTerbilang(x - 100)
ElseIf x < 1000 Then
s = ToTerbilang(x \ 100) & " ratus" & ToTerbilang(x Mod 100)
ElseIf x < 2000 Then
s = " seribu" & ToTerbilang(x - 1000)
ElseIf x < 1000000 Then
s = ToTerbilang(x \ 1000) & " ribu" & ToTerbilang(x Mod 1000)
ElseIf x < 1000000000 Then
s = ToTerbilang(x \ 1000000) & " juta" & ToTerbilang(x Mod 1000000)
ElseIf x < 1000000000000.0# Then
s = ToTerbilang(x \ 1000000000) & " miliar" & ToTerbilang(x Mod 1000000000)
End If
Return s
End Function
Dim abil() As String = {"", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas"}
Dim s As String = ""
If x < 12 Then
s = " " & abil(x)
ElseIf x < 20 Then
s = ToTerbilang(x - 10) & " belas"
ElseIf x < 100 Then
s = ToTerbilang(x \ 10) & " puluh" & ToTerbilang(x Mod 10)
ElseIf x < 200 Then
s = " seratus" & ToTerbilang(x - 100)
ElseIf x < 1000 Then
s = ToTerbilang(x \ 100) & " ratus" & ToTerbilang(x Mod 100)
ElseIf x < 2000 Then
s = " seribu" & ToTerbilang(x - 1000)
ElseIf x < 1000000 Then
s = ToTerbilang(x \ 1000) & " ribu" & ToTerbilang(x Mod 1000)
ElseIf x < 1000000000 Then
s = ToTerbilang(x \ 1000000) & " juta" & ToTerbilang(x Mod 1000000)
ElseIf x < 1000000000000.0# Then
s = ToTerbilang(x \ 1000000000) & " miliar" & ToTerbilang(x Mod 1000000000)
End If
Return s
End Function
Demikianlah Artikel Fungsi Terbilang Visual Basic .NET
Sekianlah artikel Fungsi Terbilang Visual Basic .NET kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.
Anda sekarang membaca artikel Fungsi Terbilang Visual Basic .NET dengan alamat link https://re-plye.blogspot.com/2016/06/fungsi-terbilang-visual-basic-net.html
Posting Komentar
Posting Komentar