fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. float a=0,n=0,s=1;
  6. cin>>n;
  7. while (s<=n)
  8. {
  9. a=a+(s-1)/s;
  10. s++;
  11.  
  12. }
  13. cout<<a<<endl;
  14. return 0;
  15. }
Success #stdin #stdout 0s 4500KB
stdin
45
stdout
40.605