program membaca angka

program terbilang;

uses wincrt;

var a,b,c:integer;

begin

write(‘masukkan angka= ‘);read(a);

b:=a div 10;

c:=a mod 10;

writeln;

if b=2 then write(‘dua’) else

if b=3 then write(‘tiga’) else

if b=4 then write(’empat’) else

if b=5 then write(‘lima’) else

if b=6 then write(‘enam’) else

if b=7 then write(‘tujuh’) else

if b=8 then write(‘delapan’) else

if b=9 then write(‘sembilan’);

if b>1 then write(‘ puluh ‘);

if c=2 then write(‘dua’) else

if c=3 then write(‘tiga’) else

if c=4 then write(’empat’) else

if c=5 then write(‘lima’) else

if c=6 then write(‘enam’) else

if c=7 then write(‘tujuh’) else

if c=8 then write(‘delapan’) else

if c=9 then write(‘sembilan’) else

if (b<>1) and (c=1) then write(‘satu’) else

if c>0 then write(‘ ‘);

if c=0 then write(‘nol’) else

if (b=1) and (c=1) then write(‘sebelas’) else

if (b=1) and (c<>1) then write(‘belas’);

end.

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

%d blogger menyukai ini: