Question: I am trying to find out the c code with use of arrays and pointers etc. the directions are in the picture i attempted it
I am trying to find out the c code with use of arrays and pointers etc. the directions are in the picture i attempted it and got me the answer but it needs pointers and arrays. Please help and have a copyable code. Below is what i have so far.
#include
float func(float x,float y);
float euler(float x0,float xn,float y0,int n);
int main()
{ float x0,xn,y0,e;int n;
printf(" inputn: ");
scanf("%d",&n);
printf("input x0,xn: ");
scanf("%f,%f",&x0,&xn);
printf("input y0: ");
scanf("%f",&y0);
e=euler(x0,xn,y0,n);
}
float func(float x,float y)
{
return x*x-x;
}
float euler(float x0,float xn,float y0,int n)
{ float x,y,h;
int i;
x=x0; y=y0; h=(xn-x0);
printf("y(%f)=%3.4f ",x0,y0);
for(i=1;i
y=y+h*func(x,y);
x=x0+i*h;
printf("y(%f)=%3.4f ",x,y);
}
return y;
}
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
