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