In my fgetc.in file I have 9 and in the fgetc.out it shows 41 instead of 9. I am confused what is wrong in my code but I guess it is smth wrong with EOF.
#include<stdio.h>
int main(){
    FILE *in = fopen("fgetc.in", "r");
    FILE *out = fopen("fgetc.out", "wt");
    char c;
    int a = 0;
    c = fgetc ( in );
    a = c - '0';
    while(c != EOF ){
        c = fgetc ( in );
        a = a * 10 + (c - '0');
    }
    fprintf(out, "%d" , a);
    fclose(in);
    fclose(out);
    return 0;
}
 
    