#include<stdio.h>
#include<math.h>
float f(float x, float y)
{
return (x*x-y);
}
main()
{
float x0,y0,h,xn,y1;
printf("enter te value of x0, xn and y0: ");
scanf("%f%f%f",&x0,&xn,&y0);
printf("enter the value of h: ");
scanf("%f",&h);
while(x0<xn)
{
y1=y0+h*f(x0,y0);
y0=y1;
x0=x0+h;
}
printf("Value of y is: %f",y1);
}
OUTPUT:
#include<math.h>
float f(float x, float y)
{
return (x*x-y);
}
main()
{
float x0,y0,h,xn,y1;
printf("enter te value of x0, xn and y0: ");
scanf("%f%f%f",&x0,&xn,&y0);
printf("enter the value of h: ");
scanf("%f",&h);
while(x0<xn)
{
y1=y0+h*f(x0,y0);
y0=y1;
x0=x0+h;
}
printf("Value of y is: %f",y1);
}
OUTPUT:
Comments
Post a Comment