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

Assignment Help:

 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


Related Discussions:- Write a shell script to find the factorial of a given number

New features of visual studio 2008, New Features of Visual Studio 2008 1. L...

New Features of Visual Studio 2008 1. LINQ Support LINQ primarily is the structure of many conventional question employees that allow you to perform with information in a more user

Padovan string, Padovan String Problem Description A Padovan string...

Padovan String Problem Description A Padovan string P(n) for a natural number n is defined as: P(0) = 'X' P(1) = 'Y' P(2) = 'Z' P(n) = P(n-2) + P(n-3), n

Selfcare project - strut frame work, Selfcare Project:   Technology U...

Selfcare Project:   Technology Used Strut Frame work, WAS 5.1, WPS 6.0, DB2, AJAX, Eclipse, Rational Application Developer 6 and  DB2 Selfcare is a big umbrella under whic

Shell script display time for user which is idle, Normal 0 fals...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Develop a diagram to model functionality, Develop (i) a context diagram, an...

Develop (i) a context diagram, and (ii) a use case diagram to model the following functionalities of an online brokerage house. eBroker is a discount online broker. An account h

Write a program to show ten buttons with five possible color, Write a progr...

Write a program to show ten buttons with five possible colors: red, green, orange, yellow, blue. When the user clicks on a button, its color must advance to the next color, or go b

Perl program, Input to be in the form of a string of less than 256 characte...

Input to be in the form of a string of less than 256 characters. Assume that this character string (record) can only be of the form: Last Name, First Name, Box number, City, St

Explain the use of sync and fsck, Problem 1 Define the architecture of ...

Problem 1 Define the architecture of UNIX operating system with appropriate diagram Problem 2 Define the term inter-process communication. What are several approaches t

Shell script to find a particular pattern from the file, Normal 0 ...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Cmis 102, In this assignment, you will design a program to perform the foll...

In this assignment, you will design a program to perform the following task: Calculate the total price to purchase all the components required to build a state-of-the-art gaming c

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd