c***Euler program from Koonin, Chapter 2 20 print *, 'Enter step size ( .le. 0 to stop)' read *,h if(h. le. 0.) stop nstep=3./h !number of steps to reach x=3 y=1. !y(0)=1 do ix=0,nstep-1 !loop over steps x=ix*h !last x value y=y+h*func(x,y) !new Y value from Eq. 2.6 diff=exp(-0.5*(x+h)**2)-y !compare with exact value print *, ix,x+h,y,diff enddo goto 20 !start again with new value of h end c****************************************************************** function func(x,y) func=-x*y return end c******************************************************************