wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Write a program to find the sum of 1+ 1/8 + 1/27 ...... 1/n3 , where n is the number input by the user.

Open in App
Solution

Program:
sum = 0
#Getting the number input from user
n = int(input("Enter the number: "))
for a in range(1,n+1):
#calculating the sum
sum = sum + (1/pow(a,3))
#Sum of the series is
print("The sum of the series is: ",round(sum,2))


OUTPUT:
Enter the number: 5
The sum of the series is: 1.19


flag
Suggest Corrections
thumbs-up
10
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Viewing Sections of Solids by Cutting or Slicing
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon