Home > Back-end >  For approximation, but the result is always out of 4, where is wrong
For approximation, but the result is always out of 4, where is wrong

Time:10-21

#include
#include
Double fun (double num);
Int main ()
{double num, s, a; int t; Double PI; Printf (" please enter a number: \ n "); Lf the scanf (" % ", & amp; a); Printf (" % lf \ n ", fun (a)); return 0;
}
Double fun (double num)
{double s; Int t=1; Double PI=0.0; Int sign=1; While (1/t> Num)={PI +=sign/t; T +=2; Sign=- sign; 4.0 * PI} return;
}
  • Related