✔ 最佳答案
var amount: real;
tens, dollars, cents: integer;
begin
write("Enter amount of money:");
readln(amount);
tens := trunc(amount) div 10;
writeln("Number of $10 coins: ", tens);
amount := amount - 10 * tens;
dollars := trunc(amount);
cents := 10 * (amount - dollars);
writeln("Number of $5 coins: ", dollars div 5);
dollars := dollars - 5 * (dollars div 5);
writeln("Number of $2 coins: ", dollars div 2);
dollars := dollars - 2 * (dollars div 2);
writeln("Number of $1 coins: ", dollars);
writeln("Number of $0.5 coins: ", cents div 5);
cents := cents - 5 * (cents div 5);
writeln("Number of $0.2 coins: ", cents div 2);
cents := cents - 2 * (cents div 2);
writeln("Number of $0.1 coins: ", cents)
end.
2007-03-24 01:07:25 補充:
請勿移除問題, 我會記住你.