/* program series */ /* the # sign must appear in column 1 for many C preprocessors */ #include /* library of input/output functions */ #include /* library of math functions */ void main() /* void optional for main */ /* add the first 100 terms of a simple series */ { double sum; int n; sum = 0.0; for (n = 1; n <= 100; n++) { sum = sum + 1.0/pow((double) n,2.0); /* real C programmers would write sum + = 1.0/pow((double) n,2.0); */ printf("%d %f\n",n,sum); } }