Advertisement
dyamondz

Nombres harmònics (1) - P59539

Oct 3rd, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.19 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.     cout.setf (ios::fixed);
  6.     double op,num;
  7.     cin>>num;
  8.     for(int i=1;i<=num;i++) op+=(1/double(i));
  9.     cout.precision(4);
  10.     cout<<op<<endl;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement