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
Write 3 somewhat simple scripts / programs in any language, combination of languages, and/or software. Please tell me the task you are trying to accomplish in the scripts. Idea

Define Call by value - Computer Programming? Functions are raise by writing their name and an appropriate list of arguments within parenthesis. Usually these arguments are in t

Components of .NET Framework 3.5 .NET Framework Conceptual Overview Presents the .NET Structure and its elements. Installing the .NET Framework Provides information about .NET Stru

Question 1: a) Assume that B is an array of 50 words; write a code which will place the smallest integer of array B in register AX. b) Write a small code (only three instr

Design an object definition named Pet, which should have the following fields: name: The name field holds the name of a Pet type: The type field holds the type of anima

I have constantly been emailing to get the task i had paid for to be done correctly but no replies from anyone. Not even one acknowledging my emails. Been phoning all the way from

Overview Goals: The goals for this assignment are Design and implement instantiable classes. Use arrays of objects. Read from and write to files. Implement basic

For this programming assignment, you are to develop a Fortran 90/95/2003 program to automate a useful task. The aim of the assignment is for you to reveal your competence in the Fo

Expertsmind.com is expert in java assignment help JAVA Virtual Machine A Java exclusive device or java virtual machine (JVM) is an exclusive device able of undertaking Jav

What is .NET? It is a foundation fairly neutral structure. Is a coating between the son and the selection language? It can handle many selection dialects, such as VB.NET,