#include #define MAXNUMS 50 int main() { FILE *fp; int status, n, i, a[MAXNUMS]; if ((fp = fopen("data", "r")) == NULL) { perror("data"); return 1; } for (n = 0; n < MAXNUMS && (status = fscanf(fp, "%d", &a[n])) == 1; n++) ; if (status == 0) { fprintf(stderr, "Non-numeric data\n"); return 1; } sort(n, a); /* not shown here */ for (i = 0; i < n; i++) printf("%d\n", a[i]); return 0; }