#!/bin/bash
# your code goes here
#!/bin/bash

echo "enter a number "
read n

if [ "$n" -lt 0 ]; then
  echo "factorial is not defined for negative numbers"
  exit 5
fi

fact=1
i="$n"

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

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