Advertisement
immanual1

2d

Jan 13th, 2025
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. def harmonic_sum(n):
  2. sum = 0
  3. for i in range(1, n + 1):
  4. sum += 1 / i
  5. return sum
  6.  
  7. n = int(input("Enter the value of N: "))
  8. sum = harmonic_sum(n)
  9. print("Sum of the series:", sum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement