# Answer to Question #16000 in Action Script | Flash | Flex | ColdFusion for wwktnnr

Question #16000

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 .

Expert's answer

onSelfEvent (load) {

total=0;

n=0;

k=0;

a = 1;

while (a++ < 5) {

total+=Math.pow(a,3);

trace("Nmmber "+a+"^3= "+Math.pow(a,3));

}

trace("Total="+total);

}

total=0;

n=0;

k=0;

a = 1;

while (a++ < 5) {

total+=Math.pow(a,3);

trace("Nmmber "+a+"^3= "+Math.pow(a,3));

}

trace("Total="+total);

}

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment