Computer Science, asked by arshifwzn, 5 months ago

write a program in python to input a number. Find its cube and print it with a message​

Answers

Answered by ramansangwan64
1

Answer:

Python Program for cube sum of first n natural numbers

Print the sum of series 13 + 23 + 33 + 43 + …….+ n3 till n-th term.

Examples:

Input : n = 5

Output : 225

13 + 23 + 33 + 43 + 53 = 225

Input : n = 7

Output : 784

13 + 23 + 33 + 43 + 53 +

63 + 73 = 784

# Simple Python program to find sum of series

# with cubes of first n natural numbers

# Returns the sum of series

def sumOfSeries(n):

sum = 0

for i in range(1, n+1):

sum +=i*i*i

return sum

# Driver Function

n = 5

print(sumOfSeries(n))

Similar questions