1293B. JOE is on TV! - Codeforces Solution C++

  Problem Link : 1293B. JOE is on TV! 


✅ C++ Solution :

 
#include<bits/stdc++.h>
using namespace std;
 
#define d double
 
int main()
{
  int n;
  cin>>n;
 
  d ans=0;
  for(d i=1;i<=n;i++)
  {
    ans+=(1/i);
  }
  cout<<ans;
 

 

Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook. 

😇Happy Learning!!