SHARE
TWEET

Python Harmonic Number

naeem043 Oct 10th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = int(input('Enter the number: '))
  2. sum = 0.0
  3. if n > 0:
  4.     for i in range(1,n+1):
  5.         sum += 1/i          
  6. print("Summation of Harmonic Number: "+ str(round(sum,2)))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top