C语言编程:将1元人民币兑换为1角、2角和5角的零钱,编写程序计算有多少种兑换方法?

2024-11-17 03:33:53
推荐回答(1个)
回答1:

#include

int main()
{
int i, j, k, cnt = 0;
for (i = 0; i <= 10; i ++)
for (j = 0; j <= 10; j += 2)
for (k = 0; k <= 10; k +=5)
if (i + j + k == 10)
cnt ++;
printf("%d\n", cnt);
}