#include <stdio.h>int is( int number );int main(void){ int count, i, sum;
count = 0; sum = 0; for ( i = 100; i <= 999; i++) if ( is ( i ) == 100 ) { count++; sum = sum + i; } printf("count = %d, sum = %d\n", count,sum);
return 0;}int is( int number ){ int a, b, c, result, sum; a = number / 100; b = ( number /10 ) % 10; c = number % 10; sum = a + b + c; if (sum == 5 ) result = 1; else result = 0;
return 0;}
这个程序能运行但是结果错了 ,是不是还有哪里错了啊
我才是刚刚入门的 , 能不能具体说一下错在哪里额? , 谢谢~
能具体说一下吗?
追答你的这个函数的返回值永远不是100啊