X1104: factorial2

Write a function in C++ called factorial() that will take a positive integer as input and returns its factorial as output.

Examples:

factorial(0) -> 1
factorial(3) -> 6

Your Answer:

Reset

Practice a different C++ exercise

Feedback

Your feedback will appear here when you check your answer.