Next Index Previous

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



Father of Python Language

Guido-van-Rossum

Guido van Rossum

Born: January 31, 1956, Netherlands