求助!这个程序哪里错了?
#include "stdio.h"#include "conio.h"
#define N 50
void main()
{
int i, n;
float x[N], y[N], sumx = 0, sumy = 0, equalx = 0, equaly = 0;
double sumxy = 0, sumx_2 = 0, a, b;
char answer;
{
printf("您一共要输入几组数据:");
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
printf("请输入第%d组数据(x/y):", i);
scanf("%f%f", &x[i], &y[i]);
}
for (i = 1; i <= n; i++)
{
sumx = sumx + x[i];
sumy = sumy + y[i];
sumxy = sumxy + x[i] * y[i];
sumx_2 = sumx_2 + x[i] * x[i];
}
equalx = sumx / n;
equaly = sumy / n;
b = (sumxy - sumx * sumy / n) / (sumx_2 - sumx * sumx / n);
a = equaly - b * equalx;
printf("您所要求的线性方程为:y = %.3f - (%.3f) * x.\n", a, b);
printf("您还想要继续计算下一组么(是请输入y):");
/*answer = getche();*/
scanf("%c", &answer);
}while(answer == 'y');
printf("\n按任意键退出!");
}
以上是我编的一个计算线性回归方程的程序,想让他能一次性进行多次计算,可怎么不等我输入y就自动退出循环了?各位高手帮我看一下哪里错了!!!!!