#include <stdio.h>

#include <malloc.h>

#include <math.h>


int main()

{

    int i, kor, eng, math;

int num;

    int *sum;

double std_devi, average;

    

    FILE *input_fp = fopen("file.inp", "r") , *output_fp= fopen("file.out", "w");


    if( input_fp == NULL )

    {

    fprintf(stderr, "can't open %s\n", "file.inp" );

        return;

    }

    

    if( output_fp == NULL )

    {

    fprintf(stderr, "can't open %s\n", "file.out" );

return;

    }


    if( ( sum = (int *)malloc( sizeof(int)*3 )) == NULL )

    {

    fprintf(stderr, "memory allocation error %s\n", "sum" );

    }


fscanf(input_fp, "%d \n",&num);

    for(i=0;i<num;i++) 

    {

        fscanf(input_fp,"%d %d %d",&kor,&eng,&math);

*sum=kor+eng+math;

        average=(double)kor+eng+math/num;

        std_devi=(double)(kor*kor+eng*eng+math*math)/num-average*average;

        fprintf(output_fp,"%.1lf \n",average);

fprintf(output_fp,"%.1lf \n",sqrt(std_devi));

     }

    

    fclose( input_fp );

    fclose( output_fp );

    free( sum );

return 0;

}


이 코드에서 국영수 성적  입력해야 돼는데 ... 계속 can't open file.inp만 뜨네 뭔가 빠트렸나?