请编写函数fun,其功能是:计算并输出下列多项式的值,S=(1-1/2)+(1/3-1/4)+…+(1/(2n-1)-1/2n),要求n的值大于1但不大于100
#includedoublefun(intn){doubler=0,x=0,sum=0;doublei;if(n>1&&n<=100){for(i=1;i<=n;i++){r=1/(2*i-1);x=1/(2*i);sum+=(r-x);}}returnsum;}main(){intn;doubles;voidNONO();printf("\nInputn:");scanf("%d",&n);s=