#include #include float PI = 3.14159265358979323846264338327950288419716939937510; int main ( ) { float max = 50000.0; printf ("*** Using float\n"); float k = 1.0; float v; float n = 0.0; float oldn = -1.0; while (n != oldn && k < max) { oldn = n; n = n + 1.0/(k*k); k = k + 1.0; } printf ("stopped at %20.18g", n); if (n == oldn) { printf (" (iteration %2.0f) because no difference in successive sums\n", k); } else { printf (" because # iterations = max\n"); } printf ("\nActual value is %20.18g\n", PI*PI/6.0); return 0; }