#!/bin/bash
# your code goes here

echo "enter a number"
read n

if [ "$n" -lt 1 ]; then
  echo "factorial is not defined for negative numbers"
  exit 
fi
fact=
i="$n"

while [ "$i" -gt 1 ]; do
  fact=$((fact * i))
  i=$((i - 1))
done

echo "the factorial of the given number is $fact"