Shell script to print multiplication table of given number, Programming Languages

4.      Write a shell script to print the multiplication table of given number up to a given range.

 

Program

 

# Write a shell script to print the multiplication table of given number

# up to a given range.

 echo "Enter NO.:"

read no             

echo "Enter range:"

read r

i=1

 

while test $i -le $r           #starts with 1 to given range

do

   temp=`expr $no \* $i`

   echo "$no * $i = $temp"

   i=`expr $i + 1`

done

 

Output

 

Enter NO.:

5

Enter range:

6

5 * 1 = 5

5 * 2 = 10

5 * 3 = 15

5 * 4 = 20

5 * 5 = 25

5 * 6 = 30

 

Enter NO.:

15

Enter range:

4

15 * 1 = 15

15 * 2 = 30

15 * 3 = 45

15 * 4 = 60

Posted Date: 9/26/2012 4:32:11 AM | Location : United States







Related Discussions:- Shell script to print multiplication table of given number, Assignment Help, Ask Question on Shell script to print multiplication table of given number, Get Answer, Expert's Help, Shell script to print multiplication table of given number Discussions

Write discussion on Shell script to print multiplication table of given number
Your posts are moderated
Related Questions
How do i get back data from a FOR loop in order to print them on screen?

The creation of the menu will involve writing procedural code, using decision logic, writing a loop, and using the case statement.  Although it is not required for grading, it is r

What is URL describe theri protocol? URL basicallt stands for uniform resource locator. A URL is a pointer to a particular resource on the Internet at a particular location.

Your program can be invoked with option: -d date, where date is entered in dd/mm/yyyy format. In this case, it must only print the following string: Found cookies expiring bef

hello there, I making a program for the collage but I got stuck at one point, I have a timmer that moves object pnl with the pnl.left function, but I want it when it gets to end of

Program for Operate the Rolodex Rolodex is a rotating file, usually used to record business contact information. Cards are inserted in alphabetic order by name. You operate th

a program that enter an alphabet from the user and compare it is vowel or not?

develop a pseudocode algorithm to determine the total amount of extra cost changed to the organizers for expenses accurednduring the workshop. the code is to be written for an unde

Write a detailed description on how you would go about planning information system for an organisation

The last matrix operation which we'll see is matrix multiplication. Now there we will start along with two matrices, A nxp and B pxm . Remember hat A must have similar number of c