fork download
  1. #include <stdio.h>
  2.  
  3. int main ()
  4.  
  5. {
  6.  
  7. /* variable definition: */
  8.  
  9. int count, value, sum;
  10. double avg;
  11.  
  12. /* Initialize */
  13.  
  14. count = 0;
  15.  
  16. sum = 0;
  17. avg = 0.0;
  18.  
  19. // Loop through to input values
  20.  
  21. while (count =< 1)
  22.  
  23. {
  24.  
  25. printf("Enter a positive Integer\n");
  26.  
  27. scanf("%d", &value);
  28. if (value >= 0) {
  29. sum = sum + value;
  30. count = count + 1;
  31. }
  32. else {
  33. printf("Value must be positive\n");
  34. }
  35.  
  36. }
  37.  
  38. // Calculate avg. Need to type cast since two integers will yield an integer
  39.  
  40. avg = (double) sum/count;
  41.  
  42. printf("average is %lf\n " , avg );
  43.  
  44. return 0;
  45.  
  46. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
5
9
15
72
compilation info
prog.c: In function ‘main’:
prog.c:21:15: error: expected expression before ‘<’ token
 while (count =< 1)
               ^
stdout
Standard output is empty