Advertisement
Andrey_99_cska

5.I.4

Oct 31st, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. int main()
  5. {
  6.     double n, i, s=0, a=1;
  7.     cin >>n;
  8.    for (i=1; i<=n; i++)
  9.    {
  10.        a=1.0/(i*i);
  11.        s+=a;  
  12.    }
  13.    cout<<s<<endl;
  14.    return (0);}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement