![Numerical Methods Sumit Kar, Numerical Methods, C, Timus Rak](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgEEuiVQujzDYGlv1PMDzDKYb5ozvCbIjo_Mt3FOu_A8h6GVex9UkCglRQEuc0wTKxbm_OgzCSMsAl0xTsTrdYwnZVmL3fFis99MAlE7B7SZTE3u-l8-Yoy14a7zhjLCMXS_y2grkLeaBz/s1600/c-programming-tutorial.jpg)
/*
Euler Rule
Compute:: f(0.1)=?
When f(x,y)=1+xy, y(0)=2,h=0.01
*/
#include<conio.h>
#include<stdio.h>
void main()
{
float x0,y0,h,xf,fx,x;
float f(float,float);
printf("\nEnter x0 & y0");
scanf("%f%f",&x0,&y0);
printf("\nEnter x & h");
scanf("%f%f",&x,&h);
xf=x0;fx=y0;
while(xf<=x)
{
fx=fx+h*f(xf,fx);
xf=xf+h;
}
printf("\nResult %f",fx);
getch();
}
float f(float x,float y)
{
return 1+x*y;
}
0 Comments