Write a Linux shell script to find factorial of a given number, Unix program to find factorial of n numbers
Program
clear
echo "Enter the number:"
read n
fact=1
for ((i=1;i<=n;i++))
do
fact='expr$fact\*$i'
done
echo "Factorial:"$fact
Output
Enter the number
4
Factorial:24
No comments:
Post a Comment