NOTASI ALGORITMA – NOMINAL TERBILANG

Di kesempatan yang ada ini, saya akan bagaimana membuat program yang ‘mengkonversi’ angka menjadi huruf terbilang.

Jika saya pikir-pikir, konsep dasar mengubah angka ke huruf cukup sulit. Karena angka sangat flexible sehingga dapat bernilai berapa saja, dan harus memikirkan bagaimana cara untuk membuat program ‘pengkonversi’ seperti itu. Konsep paling ‘make sense’ yang bisa saya implementasikan setelah berpikir-pikir adalah dengan prosedur dan kondisi bersarang (nested if). Jika saya jelaskan semuanya di text ini, akan terlalu banyak. Jadi pada dasarnya, inputan angka tertentu akan menghasilkan output tertentu juga (terbilang) dengan prosedur dalam kondisi bersarang.

(Maaf jika adanya kekurangan dalam segi kerapian indentasi dikarenakan tidak bisa diberi indent secara otomatis oleh karena saya copy-paste dari catatan yang saya tulis sendiri di notepad++ sebelumnya. Yang sebenarnya text aslinnya semuanya di notepad++ sudah dalam kondisi berindentasi/rapi)

 

/*
NAMA : NATHANAEL FREDERICKO W
NIM : A11.2018.10882
MAKUL : DASAR PRMROGRAMAN (TEORI)
TEMPAT : RUMAH
TANGGAL : –
PROGRAM : LOOPING DENGAN MENGHASILKAN OUTPUT TERTENTU (NOMINAL TERBILANG)
*/

// JUDUL
PENGUBAHAN ANGKA KE TERBILANG

/ KAMUS
terbilang <- void
jumUang <- integer

// DISKRIPSI
input (jumUang)
terbilang(jumUang)

void terbilang (x <- integer)
{
if(x=1)
{
output (“Satu “)
}
else if(x=2)
{
output (“Dua “)
}
else if(x=3)
{
output (“Tiga “)
}
else if(x=4)
{
output (“Empat “)
}
else if(x=5)
{
output (“Lima “)
}
else if(x=6)
{
output (“Enam “)
}
else if(x=7)
{
output (“Tujuh “)
}
else if(x=8)
{
output (“Delapan “)
}
else if(x=9)
{
output (“Sembilan “)
}
else if(x=10)
{
output (“Sepuluh “)
}
else if(x=11)
{
output (“Sebelas “)
}
else if(x>=12 and x<=19)
{
terbilang(x mod 10)
output (“Belas “)
}
else if(x>=20 and x<=99)
{
terbilang(x div 10)
output (“Puluh “)
terbilang(x mod 10)
}
else if(x>=100 and x<=199)
{
output (“Seratus “)
terbilang(x-100)
}
else if(x>=200 and x<=999)
{
terbilang(x div 100)
output (“Ratus “)
terbilang(x mod 100)
}
else if(x>=1000 and x<=1999)
{
output (“Seribu “)
terbilang(x-1000)
}
else if(x>=2000 and x<=999999)
{
terbilang(x div 1000)
output (“Ribu “)
terbilang(x mod 1000)
}
else if(x>=1000000 and x<=999999999)
{
terbilang(x div 1000000)
output (“Juta “)
terbilang(x mod 1000000)
}
else
{
output(“Terlalu banyak “)
}
output (“Rupiah”)
}

7 thoughts on “NOTASI ALGORITMA – NOMINAL TERBILANG

  1. I just want to tell you that I am newbie to weblog and honestly liked your web-site. Likely I’m want to bookmark your site . You actually come with fantastic articles. Thanks a bunch for revealing your website page.

  2. “Great post. I was checking continuously this blog and I am impressed! Extremely useful info particularly the last part 🙂 I care for such info a lot. I was seeking this particular information for a long time. Thank you and best of luck.”

  3. I just want to say I’m new to blogging and site-building and really enjoyed you’re page. More than likely I’m want to bookmark your site . You amazingly come with perfect articles. Thanks a bunch for sharing your website page.

  4. “I was curious if you ever considered changing the structure of your blog? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or two pictures. Maybe you could space it out better?”

  5. I just want to mention I am just all new to weblog and absolutely loved your web-site. Most likely I’m planning to bookmark your blog post . You certainly come with beneficial well written articles. Thanks a bunch for revealing your webpage.

Leave a Reply to here are the findings Cancel reply

Your email address will not be published. Required fields are marked *