#include <stdio.h> #include <math.h> #define f(x,y) ((2-pow(y,2))/(5*x)) int main() { double x0,y0,xn,y1,x,y,h,k1,k2,k3,k4,k; int i=0; printf("\nEnter the initial value of x: "); scanf("%lf",&x0); printf("\nEnter the initial value of y: "); scanf("%lf",&y0); printf("\nEnter the final value of x: "); scanf("%lf",&xn); printf("\nEnter the value of step length: "); scanf("%lf",&h); printf("\n NI x y k1 k2 k y1"); printf("\n=========================================================="); x=x0; y=y0; for(x=x0;x<xn;x=x+h) { k1=h*f(x,y); k2=h*f((x+h),(y+k1)); k=(k1+k2)/2; y1=y+k; y=y1; i++; printf("\n %2d %0.6lf %0.6lf %0.6lf %0.6lf %0.6lf %0.6lf",i,x,y,k1,k2,k,y1); } printf("\n=========================================================="); printf("\nHence the value of y(%0.4lf) = %0.6lf",xn,y1); }