2.5

#include<stdio.h>

int main(void)

{

         int i,n;

         double y;

 

         printf("Enter n:");

         scanf("%d",&n);

         for(i=0;i<=n;i++){

                   if(n%2==0){

                   y=y-n/(2*n-1);

                  

                   }

                   else{

                            y=y+n/(2*n-1);

                   }

         }

                   printf("%.2f",y);

                  

        

                   return 0;

}

 

posted @ 2013-10-19 23:41  zhaoyang16  阅读(118)  评论(0编辑  收藏  举报