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


Answer :-


n = int(input( "Enter n :- "))
sum = 0
for i in range (1 , n+1):
    sum += ( 1 / i**3 )

print("Sum :-", sum)


Output :-

Enter n :- 5
Sum :- 1.185662037037037

>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post