/* * Program to compute sum of integers from stdin (as a simple example of * using a while loop). */ #include int main(void) { printf("enter integers, anything else to stop\n"); int input; int sum = 0; while (scanf("%d", &input) == 1) { sum += input; } printf("sum %d\n", sum); return 0; }