This is one program in pascal that broke the nominal money, (in rupiah).
program pecah_duit;
uses wincrt;
var
a,b,c,d,e,f : integer;
harga : longint;
begin
writeln ('Harga : ');Readln(harga);
a:= harga div 50000;
if a>0 then harga:= harga - (a*50000);
b:= harga div 10000;
if b>0 then harga:= harga - (b*10000);
c:= harga div 5000;
if c>0 then harga:= harga - (c*5000);
d:= harga div 1000;
if d>0 then harga:= harga - (d*1000);
e:= harga div 500;
if e>0 then harga:= harga - (e*500);
f:= harga div 100;
if f>0 then harga:= harga - (f*100);
writeln ('50.000 = ',a );
writeln ('10.000 = ',b );
writeln ('5.000 = ',c );
writeln ('1.000 = ',d );
writeln ('500 = ',e );
writeln ('100 = ',f );
end.
program pecah_duit;
uses wincrt;
var
a,b,c,d,e,f : integer;
harga : longint;
begin
writeln ('Harga : ');Readln(harga);
a:= harga div 50000;
if a>0 then harga:= harga - (a*50000);
b:= harga div 10000;
if b>0 then harga:= harga - (b*10000);
c:= harga div 5000;
if c>0 then harga:= harga - (c*5000);
d:= harga div 1000;
if d>0 then harga:= harga - (d*1000);
e:= harga div 500;
if e>0 then harga:= harga - (e*500);
f:= harga div 100;
if f>0 then harga:= harga - (f*100);
writeln ('50.000 = ',a );
writeln ('10.000 = ',b );
writeln ('5.000 = ',c );
writeln ('1.000 = ',d );
writeln ('500 = ',e );
writeln ('100 = ',f );
end.
memecah nominal uang (selectif the money nominal)
Reviewed by Izuka
on
Friday, December 18, 2009
Rating:
No comments: