About 485,000 results
Open links in new tab
  1. Shell Program to Calculate the Factorial of a Number

    Sep 1, 2021 · Method 3: using do-while loop. Get a number; Use do-while loop to compute the factorial by using the below formula; fact(n) = n * n-1 * n-2 * .. 1; Display the result. Below is …

  2. shell script to find factorial of a number - Log2Base2

    Let's write a shell script to find the factorial of a number. 1. Get a number. 2. Use for loop or while loop to compute the factorial by using the below formula. 3. fact (n) = n * n-1 * n-2 * .. 1. 4. …

  3. bash - Is there a way to calculate factorials of #s w/o a pre ...

    Feb 26, 2016 · Use a loop to process each of the arguments. #!/bin/bash while [ $# -gt 0 ] do n=$1 on=$n fact=1 while [ $n -ge 1 ] do fact=$(expr $fact \* $n) n=$(expr $n - 1) done echo "The …

  4. Bash While Loop Examples - nixCraft

    Mar 12, 2024 · Here is a sample shell code to calculate factorial using while loop: do # use $line variable to process line echo " $line " done exec 0 <& 3 fi. You can easily evaluate the options …

  5. 8 Examples of “whileLoop in Bash - LinuxSimply

    Mar 17, 2024 · To calculate factorial using a while loop, the multiplication operator * is used inside the loop. The operator keeps multiplying the current value of the factorial and an input number …

  6. Find factorial of a Number in Shell Script – TecAdmin

    A shell script to calculate the factorial of input number using while loop. Shell #!/bin/bash # A shell script to find the factorial of a number read -p "Enter a number" num fact=1 while [ $num -gt 1 ] …

  7. Bash Factorial Program - Tutorial Kart

    In this tutorial, we will learn how to find factorial of a given number in different ways using Bash Scripting. Find Factorial using Bash While Loop. In this example, we will take a while loop and …

  8. Bash Script to Calculate Factorial of a Number - Linux Handbook

    Solution 1: Factorial bash script using recursive function. Here's a sample bash scripting for getting factorial of a given number using only a for loop. I have added the option step for …

  9. Shell script to find factorial of a number - Manoj Jha

    You can create a shell script to find the factorial of a number using a while loop. Here is an example: In this script, we prompt the user to enter a number and store it in the variable number .

  10. Shell Scripting Tutorial -21: While & Untill Loop - Factorial of a ...

    Sep 5, 2017 · In this video find out how while and untill loop works in Linux Shell scripting Programming & I will do Program of finding of factorial of a number using the...

  11. Some results have been removed
Refresh