Look at your code:
int i1, i2,x,y ;
for (x=0 ;x<10; x++)
{
...
}
for (y=0 ; y<10; y++)
{
...
}
for(i=0; i<h; i++)
{
xx[i]= x[i]*x[i];
yy[i]= y[i]*y[i];
}
for(i=0;i<h;i++)
{
sum_x+=x[i];
sum_y+=y[i];
sum_xx+= xx[i];
sum_yy+=yy[i];
sum_xy+= x[i]*y[i];
}
You can't declare an integer and treat it as an array - equally, you can't declare an array and treat it as an integer!
I suspect that your
x
and
y
should be
m
and
n
, but your code is too "student grade" for me to work it out, and I have no idea what you are actually trying to get it to do.
Do yourself a couple of favours: pick an indentation style, and stick to it. Then indent your code uniformly, so it's obvious what is what - at the moment that's all over the place, and it's much harder to read as a result. And stop using single character variable names: it means that nobody - not even you, obviously - is sure what variable does what. And that makes your code really difficult to work out. Use meaningful names and your code starts to self document, and that means it's much easier to read and a lot harder to use the wrong variables as you have. That's why your code is "student grade"! :laugh: