#!/bin/bash
# Prompt the user to enter a number
read -p "Enter a number: " number

factorial=1

# Calculate the factorial using a for loop
for (( i=1; i<=number; i++ ))
do
    factorial=$((factorial * i))
done

# Output the factorial
echo "The factorial of $number is $factorial."

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: