Answer to Question #7252 in Programming & Computer Science for chris

Question #7252
Write the function product which consumes a list of numbers and returns the product of those numbers. Make sure you follow the design recipe!
1
Expert's answer
2012-03-13T08:05:12-0400
This is example on Java:
int f(LinkedList<Integer> list){
int res = 1;
for(Integer element : list){
res *= element;
}
return res;

}


//...
LinkedList<Integer> l1 = new LinkedList<Integer>();
l1.add(2);
l1.add(3);
l1.add(4);
int product = f(l1);

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