Monday 26 December 2016

SHELL PROGRAMING

Factorial

#!/bin/bash
echo "Total no of factorial wants"
read fact

ans=1
counter=0
while [ $fact -ne $counter ]
do
        counter=`expr $counter + 1`
        ans=`expr $ans \* $counter`

done
Output:-

No comments:

Post a Comment