Hello,
Hope this is what you're looking for!
n = 3
k = 0
total = 0
while k <= n:
total += k**3
k+=1
Richard P.
asked 03/30/24Given that n refers to a positive integer, 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 variables other than n, k, and total.
Hello,
Hope this is what you're looking for!
n = 3
k = 0
total = 0
while k <= n:
total += k**3
k+=1
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.