# Answer to Question #7252 in Other 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!

Expert's answer

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);

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 orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment