Write a shell script to find the factorial of a given number, Programming Languages

 W.A.S.S to find the factorial of a given number.

Program

# W.A.S.S to find the factorial of a given number.
  

echo -e "enter number:\c"            #  \c Suppress trailing newline, –e Backslash-escaped
 #  characters  is enabled
read number
i=1
f=1

while test $i -le $number
do
f=`expr $f \* $i`                     # expression is written in back quote because it will produce output at
     # runtime
i=`expr $i + 1`
done                                       # ‘done’ is completion of while loop

echo "factorial of number is:$f"

Output

enter number:4
factorial of number is:24

Posted Date: 9/26/2012 4:24:40 AM | Location : United States







Related Discussions:- Write a shell script to find the factorial of a given number, Assignment Help, Ask Question on Write a shell script to find the factorial of a given number, Get Answer, Expert's Help, Write a shell script to find the factorial of a given number Discussions

Write discussion on Write a shell script to find the factorial of a given number
Your posts are moderated
Related Questions
I need help programming an arduino uno to scan an ean-8 student barcode and display their name and id on computer. This is a capstone project.

The standard way for debuggers to plant interactive breakpoints in a program in RAM (whatever the processor instruction set) is to save the break pointed instruction and replace it

Expertsmind brings you unique solution in java assignments Networking The term system selection represents composing applications that do across several gadgets (computers

1 Real and 2 Complex Eigenvalues    From the real eigenvalue/vector pair, l 1 and ?h 1 e l1 t ?h 1 We find the other two solutions in identical manner which we did

Write a program that will generate 25 DWORD values in the range from +/-50 representing a two dimensional array of size 5 x 5. It should then display the array as a table (5 x 5) b

Many applications require entering a number from a button and then the device counts that number down.  If it is a 2 digit number it can be stored in a single register.  If it is l

Topic Develop a Web site that will provide information about your organization. The Web site will need to have a user-friendly interface for users to enter their information;

Let us first see the skeleton of a JavaScript file. JavaScript code should be written between the and tags. The value LANGUAGE = "JavaScript" indicates to the browser that J

Expertsmind brings you unique solution in java assignments Event Delegation Model The Delegation Model with java assignment help Version 1.1 of the Java TM foundation

Find out the selling cost average for packages developed in Pascal