Shell Script For Factorial Of N Numbers
/* http://native-code.blogspot.com */ echo “Enter the number that you want to factorial” read n Factorial = 1 while test $n –gt 1 do Factorial= `expr $Factorial\* $n` n= `expr $n-1` done echo $Factorial
/* http://native-code.blogspot.com */
Output for factrial of N numbers: Enter the number that you want to factorial 6 Factorial =720
---------------------------------------------------------------
Shell Script For Fibonacci Series
/* http://native-code.blogspot.com */ echo “How many Fibonacci no. do you want to get in your screen?” read n n= `expr $n – 2` a= 0 b= 1 echo $a”, “$b count=0 while test $count –lt $n do c=`expr $a + $b` count= `expr $count + 1` a=$b b=$c echo “, “$c done
/* http://native-code.blogspot.com */
Output for Fibonacci series: How many Fibonacci no. do you want to get in your screen? 20 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us
Post a Comment