Advertisement
sellmmaahh

OR-tut4-zad3.3

Aug 6th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main()
  4. {
  5. int n, i;
  6. double suma=0;
  7. do {
  8. printf("Unesite broj n: ");
  9. scanf("%d", &n);
  10. } while (n<=0);
  11.  
  12. for (i=1; i<=n; i++)
  13.         suma+=(pow(-1,i-1))/i;
  14. printf("Koristeci %d clanova suma je: %.3f",n,suma);
  15. return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement