188k views
24 votes
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 variables other than n, k, and total.

1 Answer

3 votes

Answer:

first, we have to make value for n.

n = 10

now, use the while loop to cube the numbers.

while n = 10 and k = 4:

k = n ^ 3

lastly, make a total.

total = k

the total should be 10 cubed, given the value.

I hope this helps!

User Avilac
by
5.4k points