Question: Write a program given integral number n, will calculate and return the sum of cubes up to n. 1. Define a function named cube_sum() that

Write a program given integral number n, will calculate and return the sum of cubes up to n. 1. Define a function named cube_sum() that takes a single number parameter (int) and calculate and return the sum of the cubes up to the number n using for loop. (15 points) Hints: Cubes mean power of 3 . Hence, the cube of 9 is 93. - Here you have to calculate the cube of a series. If you want to calculate the cube up to the number n. The series will look like- 13+23+33+43++n3 Exp: when n is 3, the sum of the cubes up to 3 is calculated as follows: 13+23+33=36 2. Outside the function, prompt the user to enter a number n (int). Call the function with the user's input as an argument. Then print the result outside the function. (15 points) Example1: Enter a number: >3 The sum of cubes up to 3 is 36 Example2: Enter a number: >5 The sum of cubes up to 5 is 225
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
