I need to find the maximum number from file in.txt with content: 12 7 -14 3 -8 10 and then write it to file out.txt. Here is my full code:
#include <conio.h>
#include <stdio.h>
main() {
  int N, max;
  FILE*F;
  F = fopen("in.txt", "r");
  FILE*G;
  G = fopen("out.txt", "w");
  fscanf(F, "%d", &max);
  while (feof(F)) {
    fscanf(F, "%d", &N);
    if (max < N)
      max = N;
  }
  printf("max=%d", max);
  fprintf(G, "%d", max);
  fclose(F);
  fclose(G);
} 
 
     
    