Python Examples
5. Program to find sum of cubes of a given number.
n = int(input('Enter a value'))
r = 0
sum = 0
while n>0:
r = n%10
sum = sum+(r**3)
n = n//10
print('Sum of cubes = ',sum)
Input :
123
Output :
Sum of cubes = 36
n = int(input('Enter a value')) r = 0 sum = 0 while n>0: r = n%10 sum = sum+(r**3) n = n//10 print('Sum of cubes = ',sum)Input :
123
Output :
Sum of cubes = 36
Father of Python Language