C Program to solve using Euler Rule



Sumit Kar, Numerical Methods, C, Timus Rak





/*
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;
}


Comments

Popular posts from this blog

Write a Program to Add two 3x3 Matrix using C

C program for Unit Conversion

Write a Program to Add two 5x5 Matrix using C