Friday, October 6, 2023

π²/6

#include <math.h>
#include <iostream>
#include <cmath>
using namespace std;
double p01 (int N)
{
double s = 0 ;
for (int i = 1; i <= N; i++) s = s + 1./(i*i);
return (s);
}
int main ()
{
int n;
cout << "N=";
cin >> n;
cout << " s=" << p01(n) << "\nπ²/6=" << M_PI*M_PI/6. << endl;
}

No comments:

Post a Comment

NaCl.xyz Generator with Interactive 3D Visualization

NaCl.xyz Generator with Interactive 3D Visualization NaCl.xyz Generator with Interactive 3D Visualization ...