c2-19.c 248 B

123456789101112131415
  1. #include <stdio.h>
  2. int main( )
  3. {
  4. int sign=1;
  5. double deno=2.0,sum=1.0,term; // ¶¨Òådeno,sum,termΪ˫¾«¶È±äÁ¿
  6. while (deno<=100)
  7. {
  8. sign=-sign;
  9. term=sign/deno;
  10. sum=sum+term;
  11. deno=deno+1;
  12. }
  13. printf("%f\n",sum);
  14. return 0;
  15. }