问题 填空题

#include <stdio. h> void main( ) { int digit; long in , s; seanf(" % Id", &in ); (1) ; (2) ; while(in >0) { (3) ; s = s + digit* digit; (4) ;} pfinff( "sum = % 1dn", s ); }

答案

参考答案:if(in

解析:3.digit=in%10 4.in=in/10[解答要点] 本题的关键一是要考虑负数,还要将各个位数用模10的方法单独取出来。