1. 程式人生 > >求助!這個求π的怎麼算出來是4...... 題目是π/4=1-1/3+1/5-……

求助!這個求π的怎麼算出來是4...... 題目是π/4=1-1/3+1/5-……

=#include

include

include

using namespace std;
int main()
{
double m, s; int n; s = 0; m = 0;
for (n = 1; (1 / n) > 1E-7; n = n + 2)
{s = s + pow(-1, m) / n;
m++;
}
cout << “π=” <