"Sum of cubes: For the given integer N calculate the following sum: 1^3+2^3+…+N^3" - Snakify python coding question

 

 

 


 

CODING QUESTION

For the given integer N calculate the following sum: 1^3+2^3+…+N^3


SOLUTION

r=int(input())
sum=0
for i in range(1,r+1):
    sum+=i**3
print(sum)

 

Input : 3

Output : 36