/* * Program to add numbers from input. * * Input: Zero or more integers, read from standard input, terminated * by anything other than a number. * * Output: Sum of input numbers (zero if none). */ #include int main(void) { int input; int sum = 0; printf("enter numbers to add, non-number to end:\n"); while (scanf("%d", &input) == 1) { sum += input; } printf("result is %d\n", sum); return 0; }