赞
踩
运行结果如下
参考代码如下
- #include<stdio.h>
- #include<stdlib.h>
- int main ()
- {
- int n;
- float sum1, sum2;
- for (n = 11; ; n++)
- {
- sum1 = (n + 9) / 10.0;
- sum2 = (9 * n + 171) / 100.0;
- if (sum1 != (int)sum1)
- continue;
- if (sum2 != (int)sum2)
- continue;
- if (sum1 == sum2)
- break;
- }
- printf("共有%d个学生\n将糖果分成了%d份", (int)(n/sum1), n);
- return 0;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。