#include<stdio.h> #include<math.h> main() { int flag,i,n; double item,sum; printf("Enter n:"); scanf("%d",&n); flag=1; sum=0; for(i=1;i<=n;i++){ item=flag*(1.0/(3*i-2)); sum=sum+item; flag=-flag; } printf("sum=%.5f ",sum); }