fork download
  1. // C Code
  2. // This program will calculate the sum of 20 integers
  3. // Developer: Kai Lederer
  4. // Date: Feb 14, 2016
  5.  
  6. #include <stdio.h>
  7. int main(void) {
  8. /* variable definition */
  9. int count, value, sum;
  10. double avg;
  11.  
  12. /* \initialize */
  13. count = 0;
  14. sum = 0;
  15. avg = 0.0;
  16. return 0;
  17.  
  18. // Loop through intput values
  19. while (count < 20)
  20.  
  21. printf ("2\n");
  22. scanf("%d", &value);
  23. if (value >= 0)
  24. sum = sum + value;
  25. count = count + 1;
  26.  
  27.  
  28. printf("1\n");
  29. scanf("%d", &value);
  30. }
  31.  
Success #stdin #stdout 0s 2108KB
stdin
Standard input is empty
stdout
Standard output is empty