?

AP® Computer Science Principles

Free Version

Upgrade subject to access all content

Difficult

Factorial in Flowcharts

APCSP-EKDHEK

A factorial is a mathematical function that returns the product of the given counting number and all the counting numbers leading up to it. Counting numbers are integers greater than zero. A factorial is often indicated with an exclamation point (!). In math class you may have defined 0! =1., however, we are not worried about that situation in this problem.

For example:

3! = 3 * 2 * 1 = 6
5!  = 5 * 4 * 3 * 2 * 1 = 120

Which of the following properly defines a factorial function for a counting number n?

Select TWO answers.

A
B
C
D