Given that n refers to a positive int use a while loop to compute the sum of the cubes of the first n counting numbers, and associate this value with total. Use no <span style="text-decoration-line: none;">variables</span> other than n, k, and total.
n = int(input('Enter positive integer here: '))
n1 = 0
i = 1
while i <= n:
n1 = n1 + i ** 3
i = i + 1
print(n1)
Enter positive integer here: 6
441
Comments
Leave a comment