fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main ()
  4. {
  5. /* variable definition: */
  6. int count, value, total;
  7. /* Initialize */
  8. count = 0;
  9. total = 0;
  10. // Loop through to input values
  11. int N;
  12. printf("Enter the number of days you ran this week: \n ");
  13. scanf("%d",&N);
  14. while (count <= N){
  15. printf("Enter miles run: %d\n", value);
  16. scanf("%d", &value);
  17. if (value > 0){
  18. total = total + value;
  19. printf("Total mile this week = %d\n", total);
  20. }
  21. else {
  22. printf("What?!?!\n");
  23. }
  24. return 0;
  25. }
  26. }
  27.  
Success #stdin #stdout 0s 4256KB
stdin
2
1
1
stdout
Enter the number of days you ran this week: 
 Enter miles run: 0
Total mile this week = 1