#include<stdio.h>
#include <math.h>
#include<conio.h>
// dy/dx = 1 + xy#define Y1(x) (1 + (x) + pow(x,2)/2)
#define Y2(x) (1 + (x) + pow(x,2)/2 + pow(x,3)/3 + pow(x,4)/8)
#define Y3(x) (1 + (x) + pow(x,2)/2 + pow(x,3)/3 + pow(x,4)/8 + pow(x,5)/15 + pow(x,6)/48)
void main()
{
double y1[20],y2[20],y3[20],a,n,h,i;
int j;
clrscr();
printf("\nEnter the value of range: ");
scanf("%lf %lf",&a,&n);
printf("\n\nEnter the h: ");
scanf("%lf",&h);
for(i=a,j=0;i<=n;i=i+h,j++)
{
y1[j]=Y1(i);
y2[j]=Y2(i);
y3[j]=Y3(i);
}
printf("\nX |");
for(i=a;i<=n;i=i+h)
{
printf(" %.3lf",i);
}
printf("\n--------------------------------------------------------------------------------");
printf("\n\nY1|");
for(i=a,j=0;i<=n;i=i+h,j++)
{
printf(" %.3lf",y1[j]);
}
printf("\n\nY2|");
for(i=a,j=0;i<=n;i=i+h,j++)
{
printf(" %.3lf",y2[j]);
}
printf("\n\nY3|");
for(i=a,j=0;i<=n;i=i+h,j++)
{
printf(" %.3lf",y3[j]);
}
getch();
}
/*
OUT PUT
---------
Enter the value of range: 0 1
Enter the h: 0.1
X | 0.000 0.100 0.200 0.300 0.400 0.500 0.600 0.700 0.800 0.900 1.000
--------------------------------------------------------------------------------
Y1| 1.000 1.105 1.220 1.345 1.480 1.625 1.780 1.945 2.120 2.305 2.500
Y2| 1.000 1.105 1.223 1.355 1.505 1.674 1.868 2.089 2.342 2.630 2.958
Y3| 1.000 1.105 1.223 1.355 1.505 1.677 1.874 2.103 2.369 2.680 3.046
*/