Your current code only prints out the loop counter, and even that in floating format. It only prints out 17 values, instead of the intended 18 values. The code prints a few tabs without values between them. Value printing happens before the value is calculated, though it isn't used anyway.
Without knowing what your code is supposed to do, I would give it a try like this:
Quote:
for (i = 0; i < 18; i += 3)
{
a[i]=(float)(i*i+m)/(float)(2*i+n);(i+1)
a[i+1]=(float)((i+1)*(i+1)+m)/(float)(2*(i+1)+n);(i+2)
a[i+2]=(float)((i+2)*(i+2)+m)/(float)(2*(i+2)+n);
printf("%10.4f\t%10.4f\t%10.4f\n",i, i+1, i+2);
}
|
I haven't compiled it (it's a quick mind hack), but it should print 3 values in a row.
And maybe replace the printf statements input with the array values, instead of the loop counter.
JD
Linux Archive