#include"stdio.h"
#define N 20
void ModEuler(float(*f)(float,float),float x0,float y0,float xn,int n)
{ int i;
float yp,yc ,x=x0,y=y0,h=(xn-x0)/n;
printf("x[0]=%f\ty[0]=%f\n",x,y);
for(i=1;i<=n;i++)
{
yp=y+h*(*f)(x,y);
x=x0+i*h;
yc=y+h*(*f)(x,yp);
y=(yp+yc)/2;
printf("x[%d]=%f\ty[%d]=%f\n",i,x,i,y);
}
}
float f(float x,float y)
{
return-x*x*y*y*y;
}
void main()
{
float xn=5,x0=0,y0=1;
ModEuler(f,x0,y0,xn,N);
}