Euler’s Method in C



#include<stdio.h>
float fun(float x,float y)
{
    float f;
    f=x+y;
    return f;
}
main()
{
    float a,b,x,y,h,t,k;
    printf("\n\t\t----~~~~Crazy Coders -- Tech Apurba ~~~~----\n\n");
    printf("\nEnter x0: ");
    scanf("%f",&a);
    printf("\nEnter y0: ");
    scanf("%f",&b);
    printf("\nEnter h(interval):");
    scanf("%f",&h);
    printf("\nEnter xn: ");
    scanf("%f",&t);
    x=a;
    y=b;
    printf("\n  x\t  y\n");
    while(x<=t)
    {
        k=h*fun(x,y);
        y=y+k;
        x=x+h;
        printf("%f\t%f\n",x,y);
    }

}





For Other Programs Visit The WebSite:-   https://www.techapurba.com/

Follow Me On Social Media :-

For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/

Post a Comment

0 Comments