X597: Factorial Example 1

Write a function in Java called factorial(int n) that will take a positive integer as input and returns its factorial as output. Your solution cannot use loops and therefore must be recursive.

Examples:

factorial(1) -> 1

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.