fork download
  1. #include <stdio.h>
  2.  
  3. int main (void) {
  4. int i;
  5. int sum = 0;
  6. printf("ENter integers (0 to terminate): ");
  7. scanf("%d", &i);
  8.  
  9. while (i != 0) {
  10. sum += i;
  11. printf("%d\n", sum);
  12. scanf("%d", &i);
  13. }
  14. }
Success #stdin #stdout 0s 5284KB
stdin
 1 1 1 1 1 0
stdout
ENter integers (0 to terminate): 1
2
3
4
5