# Recursive Factorial

Easy
18
1
83.3% Acceptance

In this lab, you will implement a Java method named `factorial` within the `Main` class. This method will calculate the factorial of a given positive integer using recursion and return the resulting value.

## Objective

• Implement a recursive method to compute the factorial of a number.
• Ensure your method is efficient and handles various inputs correctly.

## Method Signature

``public static int factorial(int n)``

## Requirements

• Your method should take a single `int` parameter, `n`, and return a `int`.
• Use recursion to calculate the factorial.
• Handle edge cases, such as when `n` is `0` (since 0! = 1).

## Examples

• `factorial(5)` should return `120`, as 5! = 5 × 4 × 3 × 2 × 1 = 120.
• `factorial(0)` should return `1`, adhering to the mathematical convention that 0! = 1.

## Edge Cases

• Zero Case: The factorial of 0 is a special case and should return 1.
• Positive Integers: Ensure your method correctly handles and returns the factorial for all positive integer inputs.

## Testing

Your implementation will be tested for various scenarios, including the factorials of 5, 10, and 12, to ensure accuracy and efficiency.

## Challenges

### Challenge 1: Calculate the Factorial of 5

• Objective: Implement a `factorial` method in the `Main` class that calculates the factorial of a given number. The method should take an `int` as an argument and return a `long`.
• Expected Output: The method should return `120` when passed the value `5`.
• Objective: Your `factorial` method should handle larger numbers efficiently.
• Expected Output: The method should return `3628800` when passed the value `10`.
• Expected Output: The method should return `479001600` when passed the value `12`.