Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started