Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int counter,i = 0;
- double x = 0,y = 0;
- double f,eps;
- double fi = 1;
- f = 1+x/4;
- printf("IF VALUE OF X <= 1 THE VALUE OF COUNTER WILL NOT BE INCREASED!!!\n");
- printf("Enter your counter value\n");
- scanf_s("%d",&counter);
- printf("Enter your eps value\n");
- scanf_s("%lf", &eps);
- printf("\t x\t\t y\t\t f\n");
- for( x = -1; x<=-1+eps*double(counter) && x<= 1; x += eps, f=1+x/4 )
- {
- for(i=1;i<=counter;i++)
- if(i==1)
- {
- fi *= pow((double)(-1),i)*(pow(x,i+1)*(1/4)*(4*i-1)/(4*(i+1)));
- }
- else
- {
- fi *= pow((double)(-1),1)*(pow(x,1)*(4*i-1)/(4*(i+1)));
- }
- f += fi;
- y = pow((1+x),0.25);
- printf("\t%lf\t%lf\t%lf\n",x,y,f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement