Bạn có thể tham khảo code này (N nhập vào phải chia hết cho 1000):
uses crt;
var t1,t2,t3,n,i: integer;
begin
clrscr;
write('Nhap so tien: N='); readln(N);
i:=0;
for t1:= 0 to 10 do
for t2:= 0 to 5 do
for t3:= 0 to 2 do
begin
if N=(t1*1000+t2*2000+t3*5000) then
begin
i:=i+1;
writeln('Phuong an thu ',i,': 1K co ',t1,'; 2K co ',t2,'; 5K co ',t3);
writeln;
end;
end;
readln
end.