Ja miałem zrobione tak:
program reszta;
uses crt;
var
m : integer;
x : Currency;
begin
m:=0;
writeln('Podaj, kwote do wydania: ');
readln(x);
while x >= 5 do
begin
x:=x-5;
m:=m+1;
end;
writeln(m,' monet 5 zlotowych');
m:=0;
while x >= 2 do
begin
x:=x-2;
m:=m+1;
end;
writeln(m,' monet 2 zlotowych');
m:=0;
while x >= 1 do
begin
x:=x-1;
m:=m+1;
end;
writeln(m,' monet 1 zlotowych');
m:=0;
while x >= 0.5 do
begin
x:=x-0.5;
m:=m+1;
end;
writeln(m,' monet 0.5 zlotowych');
m:=0;
while x >= 0.2 do
begin
x:=x-0.2;
m:=m+1;
end;
writeln(m,' monet 0.2 zlotowych');
m:=0;
while x >= 0.1 do
begin
x:=x-0.1;
m:=m+1;
end;
writeln(m,' monet 0.1 zlotowych');
m:=0;
while x >= 0.05 do
begin
x:=x-0.05;
m:=m+1;
end;
writeln(m,' monet 0.05 zlotowych');
m:=0;
while x >= 0.02 do
begin
x:=x-0.02;
m:=m+1;
end;
writeln(m,' monet 0.02 zlotowych');
m:=0;
while x >= 0.01 do
begin
x:=x-0.01;
m:=m+1;
end;
writeln(m,' monet 0.01 zlotowych');
m:=0;
readln(x);
end.
ale to niby nie jest to, jeszcze muszę jakąś tablice dodać, gdzie będę wpisywał jakie nominały są dostępne. Liczba monet nie ograniczona, ale okazało się, że ma wydawać resztę za pomocą dostępnych nominałów np mam tylko 5zl i 1 zl.
To jest w pascalu, a tu nie widzie osobnego działu tego języka więc tu piszę tu.
Z góry dzięki za pomoc
Pozdrawiam