本帖最后由 int a 于 2019-12-3 23:25 编辑
- #include <stdio.h>
- #include <stdlib.h>
- int main(void)
- {
- int x;
- int a,b,c;
-
- printf("输入钱数:");
- scanf("%d",&x);
- printf("组合方案有:");
- for(a=1;a<x*10;a++)
- {
- for(b=1;b<x*10/2;b++)
- {
- for(c=1;c=x*10/5;c++)
- {
- if(a+b*2+c*5==x*10){
- printf("一角:%d 两角:%d 三角:%d",a,b,c);
- }
- }
- }
- }
-
- return 0;
- }
复制代码 |