program pu;
var
i,n,x: integer;
k : array [1..10] of integer;
begin
write('Masukkan banyak uang yang anda punya : ');readln(n);
k[1]:=1000;
k[2]:=500;
k[3]:=200;
k[4]:=100;
k[5]:=50;
k[6]:=20;
k[7]:=10;
k[8]:=5;
k[9]:=2;
k[10]:=1;
for i:= 1 to 10 do
begin
if n >= k[i] then
begin
x:= n div k[i];
n:= n mod k[i];
writeln(k[i],' ',x);
end;
end;
readln;
end.
No comments:
Post a Comment