Help me in solving CPPFALL340 problem

My issue

code for this problem

My code

void userFunction() {
    
    // Open files in respective modes
        char *inputfilename = "/home/codechef/input.txt";
    FILE *inputfile = fopen(inputfilename, "r");
    char *outputfilename = "/home/codechef/output.txt";
    FILE *outputfile = fopen(outputfilename, "w");
    
    int number;
    
    // Read and write the numbers from the file
    while (fscanf(inputfile, "%d", &number) != EOF) {
        fprintf(outputfile, "%d\n", number);
    }
    
    fclose(inputfile);
    fclose(outputfile);

    system("cat /mnt/codechef/output.txt");
}  

Learning course: Learn Programming and Problem Solving using C++
Problem Link: https://www.codechef.com/learn/course/sit-cpp-fall/SITFALL52/problems/CPPFALL340