opens and tests the input files for reading and the output file for writing

f1_ptr = fopen("prime","r");

if(f1_ptr == NULL)

{

printf("Can not open file1");

exit(-1);

}

f2_ptr = fopen("other","r");

if(f2_ptr == NULL)

{

printf("Can not open file2");

exit(-1);

}

f3_ptr = fopen("result","w");

if(f3_ptr == NULL)

{

printf("Can not open file3");

exit(-1);

}