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