#!/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"
IyEvYmluL2Jhc2gKIyB5b3VyIGNvZGUgZ29lcyBoZXJlCgplY2hvICJlbnRlciBhIG51bWJlciIKcmVhZCBuCgppZiBbICIkbiIgLWx0IDEgXTsgdGhlbgogIGVjaG8gImZhY3RvcmlhbCBpcyBub3QgZGVmaW5lZCBmb3IgbmVnYXRpdmUgbnVtYmVycyIKICBleGl0IApmaQpmYWN0PQppPSIkbiIKCndoaWxlIFsgIiRpIiAtZ3QgMSBdOyBkbwogIGZhY3Q9JCgoZmFjdCAqIGkpKQogIGk9JCgoaSAtIDEpKQpkb25lCgplY2hvICJ0aGUgZmFjdG9yaWFsIG9mIHRoZSBnaXZlbiBudW1iZXIgaXMgJGZhY3Qi