Advertisement
evgenko

Leo_h_lab6_2

Dec 13th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main()
  4. {
  5.     float x,e;
  6.     printf("Enter the x: ");
  7.     scanf("%f",&x);
  8.  
  9.     printf("Enter the e: ");
  10.     scanf("%f",&e);
  11.     float n = x;
  12.     float npr = 0;
  13.     int i=1;
  14.     while(n-npr<=e){
  15.         printf("%d : %f\n",i,n);
  16.         npr=n;
  17.         i++;
  18.         n =  pow(x,i);
  19.     }
  20.     printf("first i: %d\n",i);
  21.     printf("first n: %f\n",n);
  22.     return 0;
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement