Tag: bash program

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

    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 $mul } echo “Enter value…

  • Bash Program to check if a number is Armstrong:Shell Scripting

    Bash Program to check if a number is Armstrong:Shell Scripting

    Shell scripting is a command line scripting language used by Unix- Like environment. The below program is a Bash program to check if a number is Armstrong or not. Whats is Armstrong number? An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to…