fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. #include
  5. int main ()
  6. {
  7. /* variable definition: */
  8. int count, value, sum;
  9. double avg;
  10. /* Initialize */
  11. count = 0;
  12. sum = 0;
  13. avg = 0.0;
  14. // Loop through to input values
  15. while (count < 10)
  16. {
  17. printf(“Enter a positive integer\n”);
  18. scanf (%d, &value);
  19. if (value >= 0 {
  20. sum = sum + value
  21. count = count + 1;
  22. }
  23. else {
  24. printf (“Value must be positive\n”);
  25. }
  26. }
  27. // Calculate avg. Need to type cast since two integers will yield an integers
  28. avg = (double) sum/count;
  29. printf(“average is %1f\n “ , avg );
  30. return 0;
  31. }
  32.  
  33.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:4:10: error: #include expects "FILENAME" or <FILENAME>
 #include
          ^
prog.c:5:5: warning: ‘main’ is normally a non-static function [-Wmain]
 int main ()
     ^~~~
prog.c: In function ‘main’:
prog.c:17:10: error: stray ‘\342’ in program
   printf(“Enter a positive integer\n”);
          ^
prog.c:17:11: error: stray ‘\200’ in program
   printf(“Enter a positive integer\n”);
           ^
prog.c:17:12: error: stray ‘\234’ in program
   printf(“Enter a positive integer\n”);
            ^
prog.c:17:13: error: ‘Enter’ undeclared (first use in this function)
   printf(“Enter a positive integer\n”);
             ^~~~~
prog.c:17:13: note: each undeclared identifier is reported only once for each function it appears in
prog.c:17:19: error: expected ‘)’ before ‘a’
   printf(“Enter a positive integer\n”);
                   ^
prog.c:17:37: error: stray ‘\’ in program
   printf(“Enter a positive integer\n”);
                                     ^
prog.c:17:39: error: stray ‘\342’ in program
   printf(“Enter a positive integer\n”);
                                       ^
prog.c:17:40: error: stray ‘\200’ in program
   printf(“Enter a positive integer\n”);
                                        ^
prog.c:17:41: error: stray ‘\235’ in program
   printf(“Enter a positive integer\n”);
                                         ^
prog.c:18:8: error: stray ‘\342’ in program
 scanf (“%d, &value);
        ^
prog.c:18:9: error: stray ‘\200’ in program
 scanf (“%d, &value);
         ^
prog.c:18:10: error: stray ‘\234’ in program
 scanf (“%d, &value);
          ^
prog.c:18:11: error: expected expression before ‘%’ token
 scanf (“%d, &value);
           ^
prog.c:19:16: error: expected ‘)’ before ‘{’ token
 if (value >= 0 {
                ^
prog.c:24:14: error: stray ‘\342’ in program
      printf (“Value must be positive\n”);
              ^
prog.c:24:15: error: stray ‘\200’ in program
      printf (“Value must be positive\n”);
               ^
prog.c:24:16: error: stray ‘\234’ in program
      printf (“Value must be positive\n”);
                ^
prog.c:24:39: error: stray ‘\’ in program
      printf (“Value must be positive\n”);
                                       ^
prog.c:24:41: error: stray ‘\342’ in program
      printf (“Value must be positive\n”);
                                         ^
prog.c:24:42: error: stray ‘\200’ in program
      printf (“Value must be positive\n”);
                                          ^
prog.c:24:43: error: stray ‘\235’ in program
      printf (“Value must be positive\n”);
                                           ^
prog.c:26:1: error: expected expression before ‘}’ token
 }
 ^
prog.c:29:8: error: stray ‘\342’ in program
 printf(“average is %1f\n “ , avg );
        ^
prog.c:29:9: error: stray ‘\200’ in program
 printf(“average is %1f\n “ , avg );
         ^
prog.c:29:10: error: stray ‘\234’ in program
 printf(“average is %1f\n “ , avg );
          ^
prog.c:29:11: error: ‘average’ undeclared (first use in this function)
 printf(“average is %1f\n “ , avg );
           ^~~~~~~
prog.c:29:19: error: expected ‘)’ before ‘is’
 printf(“average is %1f\n “ , avg );
                   ^~
prog.c:29:23: error: invalid suffix "f" on integer constant
 printf(“average is %1f\n “ , avg );
                       ^~
prog.c:29:25: error: stray ‘\’ in program
 printf(“average is %1f\n “ , avg );
                         ^
prog.c:29:28: error: stray ‘\342’ in program
 printf(“average is %1f\n “ , avg );
                            ^
prog.c:29:29: error: stray ‘\200’ in program
 printf(“average is %1f\n “ , avg );
                             ^
prog.c:29:30: error: stray ‘\234’ in program
 printf(“average is %1f\n “ , avg );
                              ^
prog.c:9:8: warning: variable ‘avg’ set but not used [-Wunused-but-set-variable]
 double avg;
        ^~~
prog.c: In function ‘main’:
prog.c:31:1: error: expected declaration or statement at end of input
 }
 ^
At top level:
prog.c:5:5: warning: ‘main’ defined but not used [-Wunused-function]
 int main ()
     ^~~~
stdout
Standard output is empty