0

```
#include<stdio.h>
#include<math.h>
#define max 100
double f(double y);
int k, i;
double y[max];
double x[max];
void copyarray(double[], double[]);
main()
{
FILE *file;
double h, x, y;
printf("this program does a first order ODE for dy/dx=-y+1 with initial condition of y(0)=0 from x=0 to x=0.9\n");
printf("input the step size (h>0):\n");
scanf("%lf",&h);
k=(int)((0.9-0)/h);
x[0]=0;
y[0]=0;
file = fopen("euler.data","w");
for(i=0;i<k;i++){
x[i+1]=x[i]+h;
y[i+1]=y[i]+h*f(y[i]);
fprintf(file,"4.2%lf\t4.2%lf\n",x[i],y[i]);
}
fclose(file);
}
double f(double y){
int i;
double sum, ysum;
copyarray(x,y);
for(i=0;i<k;i++){
ysum=-y[i];
}
sum=ysum+1;
return(sum);
}
```

anything wrong with the code???? cos it keeps on getting error for array...can someone correct me?? and regarding coding for euler righ???

really need help....plsss...thankyou