Menu Close

Find the Sum of the Series: 1 + 1/2 + 1/3 + .. + 1/N.

Python Program to Find the Sum of the Series: 1 + 1/2 + 1/3 + .. + 1/N

Input:
The number of terms

Output:
Print the Sum of Series

N=int(input('Enter the N Number of terms: '))
sum1=0
for i in range(1,N+1):
  sum1+=(1/i)
print("Sum of Series: {:.2f}".format(sum1))

Input_1:
Enter the N Number of terms: 7
Output:
Sum of Series: 2.59


Input_2:
Enter the N Number of terms: 15
Output:
Sum of Series: 3.32


Input_3:
Enter the N Number of terms: 50
Output:
Sum of Series: 4.50


Morae Q!