编辑代码

#include <stdio.h>

void makeChange(int amount) {
    int coins[] = {25, 10, 5, 1}; // 面额从大到小排序
    int numCoins = sizeof(coins) / sizeof(coins[0]);

    printf("找零 %d 美分的硬币为:\n", amount);

    for (int i = 0; i < numCoins; ++i) {
        while (amount >= coins[i]) {
            printf("%d 美分 ", coins[i]);
            amount -= coins[i];
        }
    }

    printf("\n");
}

int main() {
    int amount = 48;

    makeChange(amount);

    return 0;
}