bartek27210

zadanie

Feb 1st, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7.   int i=0;
  8.   int n=0;
  9.   double x=0;
  10.   double suma=0;
  11.   printf("podaj x");
  12.   fflush(stdin);
  13.   scanf("%lf",&x);
  14.   printf("podaj n");
  15.   while(1)
  16.   {
  17.       fflush(stdin);
  18.       scanf("%d",&n);
  19.       if(n>0)
  20.     break;
  21.   }
  22.   for(i=0;i<=n;i++)
  23.     suma=suma+(pow(-1,i+1)*((pow(x,i))/i));
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment