Calculate the sum of cubes. If the input is x, the sum of cubes is equal to: 13 + 23 + ... + x3 Take input for the number of cubes to sum. No error checking is needed. Specifically, you may assume that the input is always a positive integer Here are some sample runs: Enter how many cubes to sum: 1 1 Enter how many cubes to sum: 3 36 Enter how many cubes to sum: 4 100 Enter how many cubes to sum: 2 9

Respuesta :

Answer:

In Python:

cubes = int(input("Enter how many cubes to sum: "))

sum = 0

for i in range(cubes+1):

   sum = sum + i**3

print(sum)

Step-by-step explanation:

This line prompts the user for the number of cubes

cubes = int(input("Enter how many cubes to sum: "))

This initializes sum to 0

sum = 0

This iterates through the inputted number

for i in range(cubes+1):

This calculates the sum of the cube of the numbers

   sum = sum + i**3

This prints the calculated sum

print(sum)