PTA-换硬币 输出有问题

img

img

如何按照题目要求输出,就是按硬币数量从大到小输出。已经写完大部分了,就是输出格式不对

修改如下,供参考:

#include <stdio.h>
int main()
{
    int x, a, b, c, t, count = 0;
    scanf("%d", &x);
    for (a = x / 5; a > 0; a--)
    {
        for (b = x / 2; b > 0; b--)
        {
            for (c = x; c > 0; c--)
            {
                if (5 * a + 2 * b + c == x)
                {
                    t = a + b + c;
                    printf("fen5:%d, fen2:%d, fen1:%d, total:%d\n", a, b, c, t);
                    count++;
                }
            }
        }
    }
    printf("count = %d", count);
    return 0;
}