An open API service indexing awesome lists of open source software.

https://github.com/copyleftdev/pascal-wtf


https://github.com/copyleftdev/pascal-wtf

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# Factorial Calculator in Pascal

This program, written in Pascal, calculates the factorial of a given number using a recursive approach.

## Overview

The FactorialCalculator prompts the user for an integer input. It then calculates the factorial of the number provided by the user using a recursive function. If a negative number is input, the user will be notified that they should provide a non-negative integer.

## How to Run

### Prerequisites

- A Pascal compiler, such as Free Pascal.
- Knowledge on how to compile and run Pascal programs.

### Compilation and Execution

1. Save the provided code into a file named `FactorialCalculator.pas`.
2. Compile the program using a Pascal compiler. For example, using Free Pascal:

```bash
fpc FactorialCalculator.pas
```

3. After compilation, run the executable:

```bash
./FactorialCalculator
```

## Usage

Upon execution, the program will prompt:

```
Enter a number to calculate its factorial:
```

Input a non-negative integer and press enter. The program will then display the factorial of the given number. If a negative number is input, you'll be prompted to enter a non-negative integer.