Problem Description
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 SeriesCODING ARENA
n=int(input())
sum1=0
for i in range(1,n+1):
sum1=sum1+(1/i)
print(round(sum1,2))
Test Case 1
Input (stdin)7
Expected Output2.59
Test Case 2
Input (stdin)15
Expected Output3.32
No comments:
Post a Comment