#include<bits/stdc++.h> using namespace std; int main() { double n,i; cin>>n; double sum1=0,sum2=0; for(i=1;i<=n;i+=2) { sum1+=1/i; } for(i=2;i<=n;i+=2) { sum2+=1/i; } cout<<sum1-sum2<<endl; return 0; }
No comments