Segmentation fautl <corde dumped> 에러가 나요ㅠㅠ

#include<stdio.h>
#include<math.h>
double main()
{
 char star;
 int kor, eng, math, sum;
 int i, n;
 double std_devi, average;


 FILE *input_fp, *output_fp;

 if((input_fp = fopen("hw1.inp", "r"))==NULL);
 {
  fprintf(stderr, "can't open %s\n", "1.out");
 }
 
 input_fp=fopen("hw1.inp", "r");
 output_fp=fopen("hw1.out", "w");

 fscanf(input_fp,"%d",&n);
 
 for(i=0;i<n;i++)
 {
  fscanf(input_fp,"%d %d %d",&kor,&eng,&math);
  average=(double)(kor+eng+math)/n;
  std_devi=(double)(kor*kor+eng*eng+math*math)/n-average*average;
  fprintf(output_fp,"%.1lf %.1lf",average,std_devi);
  
 }


입력파일에 첫쨋줄은 사람 수,
둘째줄 부터는 한명씩 국어 영어 수학 성적이고
출력파일에는 과목별 평균이랑 표준편차 나오게 하는 소스인데
자꾸 에러가남 ㅠㅠ
왜그러는지 좀 알려주세요