Factorial Calculation in Python
This repository contains a Python script to calculate the factorial of a given number.
About Factorial
In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120.
Implementation
The factorial calculation is implemented in Python using an iterative approach. The script factorial.py defines a function factorial(n) that takes an integer n as input and returns the factorial of n.
Usage
To use the factorial calculation script, follow these steps:
Clone this repository: bash git clone https://github.com/your-username/factorial-calculation.git
Navigate to the repository directory: bash cd factorial-calculation
Run the script with Python: bash python factorial.py
Enter a non-negative integer when prompted to calculate its factorial.
Example
Here's an example of calculating the factorial of 5 using the script: bash Enter a number to calculate its factorial: 5 The factorial of 5 is 120