# Answer to Question #75828 in Algorithms for Marquise Blalock

Question #75828

Write a pseudocode algorithm to compute the product of the first n positive integers. How many multiplications does your algorithm perform?

Expert's answer

Input: n

If n≤2 then

P=n

Else {

P=2

For i=3 to n

P=i∙P }

Return P // product of the first n positive integers

The algorithm perform does not perform multiplications if n≤2, and it performs (n-2) multiplications if n>2.

If n≤2 then

P=n

Else {

P=2

For i=3 to n

P=i∙P }

Return P // product of the first n positive integers

The algorithm perform does not perform multiplications if n≤2, and it performs (n-2) multiplications if n>2.

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