1-1/2+1/3-1/4~+1/99-1/100

来源:互联网 发布:淘宝5元红包坑坏卖家 编辑:程序博客网 时间:2024/05/21 03:16
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
main()
{
      int a,b,i;
      //scanf(""
      float w=0;
      for(i=0;i<100;i++)
      w=w+pow(-1,i)/(i+1);
      printf("%f\n",w);
      system("pause");
      return 0;
     
     
      }
0 0
原创粉丝点击