下列程序的运行结果为【 】。 #include<math.h> #include<stdio.h> main() { int s=1; float n=1,pi=0; double t=1;

admin2013-06-11  24

问题 下列程序的运行结果为【  】。
   #include<math.h>
   #include<stdio.h>
   main()
   {  int s=1;
      float n=1,pi=0;
      double t=1;
      while(fabs(t)>=2e-6)
      {   pi+=t;
          n+=2;
          s=-s;
          t=s/n;
      }
      pi*=4;
      printf("pi=%.6f\n",pi);
   }

选项

答案3.141592

解析
转载请注明原文地址:https://kaotiyun.com/show/5tJp777K
0

最新回复(0)