WAP Factorial Of Any Number Gain Infiniti

WAP Factorial Of Any Number


factorial=1
for ((index=1 ; index <= $1 ; index++ ))
do
    factorial=`expr $index \* $factorial`
done
echo "Factorial of $1 = $factorial"


OUTPUT:-

#!/bin/bash
#[root@localhost scripts]# ./factorial 5
#Factorial of 5 = 120

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 

Design By Manish and Ranjan