Select Git revision
Forked from
Peter Gerwinski / hp
48 commits behind the upstream repository.
Peter Gerwinski authored
sum-02.c 275 B
#include <stdio.h>
#include <math.h>
/* 1/1² + 1/2² + 1/3² + ... = pi²/6 */
int main (void)
{
float pi = M_PI;
printf ("%0.9f\n", pi * pi / 6.0);
float S = 0.0;
for (float x = 1; x <= 1000000; x++)
S += 1.0 / (x * x);
printf ("%0.9f\n", S);
return 0;
}