#!/bin/bash
# your code goes here
echo "enter a number"
read n
if [ "$n" -lt 0 ]; then
echo "factorial is not defined for negative numbers"
exit 1
fi
fact=1
i="$n"
while [ "$i" -gt 1 ]; do
fact=$((fact * i))
i=$((i - 1))
done
echo "the factorial of the given number is $fact"
IyEvYmluL2Jhc2gKIyB5b3VyIGNvZGUgZ29lcyBoZXJlCgplY2hvICJlbnRlciBhIG51bWJlciIKcmVhZCBuCgppZiBbICIkbiIgLWx0IDAgXTsgdGhlbgogIGVjaG8gImZhY3RvcmlhbCBpcyBub3QgZGVmaW5lZCBmb3IgbmVnYXRpdmUgbnVtYmVycyIKICBleGl0IDEKZmkKCmZhY3Q9MQppPSIkbiIKCndoaWxlIFsgIiRpIiAtZ3QgMSBdOyBkbwogIGZhY3Q9JCgoZmFjdCAqIGkpKQogIGk9JCgoaSAtIDEpKQpkb25lCgplY2hvICJ0aGUgZmFjdG9yaWFsIG9mIHRoZSBnaXZlbiBudW1iZXIgaXMgJGZhY3Qi