Program to Find Fibonacci Series using Shell Script

This is the bash code for Fibonacci Series upto a number n which will be inserted by user. Code: clear echo “Program to Find Fibonacci Series” echo “How many number of terms to be generated ?” read n x=0 y=1 i=2 echo “Fibonacci Series up to $n terms :” echo […]

Advertisements

Program to Calculate Combination [nCr] in Bash: Shell Scripting

The following shell scripting program is written in bash to calculate combination formula which is n! /(n-r)!r!. Code: #!/bin/bash clear echo “Program to find Combination in Probability” function fact { mul=1 i=$1 while [[ $i -gt 1 ]] do sub=`expr $i – 1` mul=`expr $mul \* $i` i=$sub done echo […]

Advertisements