Advertisement
Guest User

Untitled

a guest
Oct 8th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define MAXSCORE 100,000
  4.  
  5.  
  6. int main() {
  7.  
  8. FILE *ifp = fopen("inputfile1.txt", "r");
  9. int i, n, x, max_guess, min_guess;
  10. double avg_guess;
  11.  
  12. fscanf(ifp, "%d", &n);
  13. for (i=0; i<n; i++){
  14.  
  15. fscanf(ifp,"%d", &x);
  16. printf("%d\n", x);
  17. avg_guess += x;
  18. }
  19. avg_guess = avg_guess/n;
  20. printf("avg_guess = %f/n",avg_guess);
  21.  
  22.  
  23.  
  24. fclose(ifp);
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement