Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main(){
- int n,i,j;
- double suma=0;
- double gornji,clan;
- double donji=0;
- do{
- printf("\n\tMolimo unesite vrednost za N-> ");
- scanf("%d",&n);
- } while(n<=0);
- for(i=1;i<n;i++){
- gornji=pow(-2,i);
- donji+=i;
- clan=gornji/donji;
- printf("\n\tclan[i=%d]= %lf",i,clan);
- suma+=clan;
- }
- printf("\n\tsuma= %lf\t",suma);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement