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