Arsip: Terbilang


by LuriDarmawan in Articles more 19 years ago 3270
Skrip berikut berguna untuk kawan-kawan yang ingin mengahilkan 'terbilang' dari suatu nilai.
function Terbilang(x:integer):string;
const
abil : array[0..11] of string[10]=('','satu','dua','tiga',
'empat','lima','enam','tujuh','delapan','sembilan',
'sepuluh','sebelas');
begin
if (x < 12) then
Result := ' ' + abil[x]
else
if (x < 20) then
Result := Terbilang(x-10) + ' belas'
else
if (x < 100) then
Result := Terbilang(x div 10) + ' puluh' +
Terbilang(x mod 10)
else
if (x < 200) then
Result := ' seratus' + Terbilang(x-100)
else
if (x < 1000) then
Result := Terbilang(x div 100) + ' ratus' +
Terbilang(x mod 100)
else
if (x < 2000) then
Result := ' seribu' + Terbilang(x-1000)
else
if (x < 1000000) then
Result := Terbilang(x div 1000) + ' ribu' +
Terbilang(x mod 1000)
else
if (x < 1000000000) then
Result := Terbilang(x div 1000000) + ' juta' +
Terbilang(x mod 1000000);
end;  

selamat mencoba.

referensi:
http://delphi-id.org/dpr/index.php?name=PNphpBB2&file=viewtopic&t=135#667

AI Forward

๐Ÿš€ We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now: https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com