Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int i = 1;
- printf("Enter the x: ");
- float x,e;
- scanf("%f",&x);
- printf("Enter the ะต: ");
- scanf("%f",&e);
- float n = 1./ pow(x,i);
- float npr=0;
- int index;
- float no = 0;
- while(n-npr>=e){
- printf("%f\n",n);
- npr = n;
- i++;
- n = 1./pow(x,i);
- }
- i=2;
- npr = 1./pow(x,1);
- n = 1./pow(x,i);
- while (npr-n>=e){
- i++;
- npr=n;
- n=1./pow(x,i);
- }
- printf("Index : %d", i);
- printf("n : %f",n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement