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 .
1
Expert's answer
2012-10-09T09:19:19-0400
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);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS