Python Program for cube sum of first n natural numbers | Programming with python

preview_player
Показать описание
Python Program for cube sum of first n natural numbers .

code:

def natural(n):
#declare the variable to store the addition of first n natural number
sum=0
for i in range(1,n+1):
sum=sum+i*i*i
print("the sum of first ", n ," natural number is:",sum)
n=int(input("Enter the number:"))
#call the function
natural(n)

like , comment , share and subscribe to channel
Рекомендации по теме