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

Explain what is html language with an example, Explain what is HTML languag...

Explain what is HTML language with an example? HTML is the HyperText Markup Language. HTML files are text files featuring semantically tagged elements. HTML filenames are suff

Write a program for random number generator, * Comments in your code are re...

* Comments in your code are required * Main Program Operation:  # Your program should first prompt the user for an integer to seed the random number Generator. "Enter an seed

Write a function that will read the atoms for a protein, Write a function r...

Write a function readPDBfile('filename') that will read the atoms for a protein stored in a PDB file, whose name is provided as an input to the function (note that this name should

COS-101: INTRODUCTION TO COMPUTERS, COS-101: INTRODUCTION TO COMPUTERS PRO...

COS-101: INTRODUCTION TO COMPUTERS PROJECT DESCRIPTION The Computer Fundamentals Project provides you with a chance to apply what you have learned about computer fundamentals to

Maze game, The Maze Game from Laboratory 7 loads its maze directly in the p...

The Maze Game from Laboratory 7 loads its maze directly in the program's code. This should be avoided as it requires the program to be recreated if the maze needs to be changed. In

Unix, 1. Write a shell script to locate executable files. This script takes...

1. Write a shell script to locate executable files. This script takes a list of file names from the command line and determines which would be executed had these names been given a

JUnit test, hi, can you help me with testing java classes I have wrote usin...

hi, can you help me with testing java classes I have wrote using java and jsp and servlet in eclipse ? I want to use JUnit for testing

Shell script for a given number is armstrong number or not, Normal 0 ...

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

I got a project and i need help , the details on the two pictures on the li...

the details on the two pictures on the link below : http://rak-up.com/up/files/18637.jpg ">http://rak-up.com/up/files/18636.jpg http://rak-up.com/up/files/18637.jpg

Advantages of visual basic programming language, Advantages of visual basic...

Advantages of visual basic programming language Visual Basic is an exclusive selection language published by Microsoft Company, so programs published in Visible Basic cannot, e

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