program memecakan_rupia;
uses crt;
var awal,uang:longint;
ratusribu,limpulrb,duapulrb,sepulrb,limrb,duarb,serb:byte;
limrts,duarts,serts,limpul:byte;
label lagi;
begin
lagi:
writeln('memecakan mata uang dalam pecahan rupia ');
writeln('======================================= ');
write('mesukan jumla uang anda RP= ');readln(uang);
if uang <0 data-blogger-escaped-p="" data-blogger-escaped-then=""> begin
writeln('masukan salah');
goto lagi;
end
else
begin
awal:=uang;
ratusribu:=uang div 100000;uang:=uang mod 100000;
limpulrb:=uang div 50000;uang:=uang mod 50000;
duapulrb:=uang div 20000;uang:=uang mod 20000;
sepulrb:=uang div 10000;uang:=uang mod 10000;
limrb:=uang div 5000;uang:=uang mod 5000;
duarb:=uang div 2000;uang:=uang mod 2000;
serb:=uang div 1000;uang:=uang mod 1000;
limrts:=uang div 500;uang:=uang mod 500;
duarts:=uang div 200;uang:=uang mod 200;
serts:=uang div 100;uang:=uang mod 100;
limpul:=uang div 50;uang:=uang mod 50;
{pecahan}
if ratusribu <>0 then writeln('pecahan seratus ribu ',ratusribu,' lembar');
if limpulrb <>0 then writeln('pecahan limapuluh ribr ',limpulrb,' lembar');
if duapulrb <>0 then writeln('pecahan duapuluh ribu ',duapulrb,' lembar');
if sepulrb <>0 then writeln('pecahan sepuluh ribu ',sepulrb,' lembar');
if limrb <>0 then writeln('pecahan lima ribu ',limrb,' lembar');
if duarb <>0 then writeln('pecahan dua ribu ',duarb,' lembar');
if serb <>0 then writeln('pecahan seribu ',serb,' lembar');
if limrts <>0 then writeln('pecahan limaratus rupiah ',limrts,' lembar');
if duarts <>0 then writeln('pecahan duaratus rupiah ',duarts,' lembar');
if serts <>0 then writeln('pecahan seratus rupiah ',serts,' lembar');
if limpul <>0 then writeln('pecahan limapuluh rupiah ',limpul,' lembar');
end;
end.
Thursday, October 23, 2014
Program Memecahkan Mata Uang Rupiah
6:47 AM
No comments
HASIL OUTPUT
Silakan di coba.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment