#include <ctype.h>
#include <stdio.h>
int main(void) {
int sum = 0;
for (;;) {
if (!isdigit((unsigned char)ch
)) break; // leave loop with ENTER, EOF, 'a', ... sum += ch - '0';
}
printf("sum of digits is %d.\n", sum
); return 0;
}
I2luY2x1ZGUgPGN0eXBlLmg+CiNpbmNsdWRlIDxzdGRpby5oPgoKaW50IG1haW4odm9pZCkgewogICAgaW50IHN1bSA9IDA7CiAgICBmb3IgKDs7KSB7CiAgICAgICAgaW50IGNoID0gZ2V0Y2hhcigpOwogICAgICAgIGlmICghaXNkaWdpdCgodW5zaWduZWQgY2hhciljaCkpIGJyZWFrOyAvLyBsZWF2ZSBsb29wIHdpdGggRU5URVIsIEVPRiwgJ2EnLCAuLi4KICAgICAgICBzdW0gKz0gY2ggLSAnMCc7CiAgICB9CiAgICBwcmludGYoInN1bSBvZiBkaWdpdHMgaXMgJWQuXG4iLCBzdW0pOwogICAgcmV0dXJuIDA7Cn0K