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
Question 1 What is CISC & RISC? Explain their addressing modes Question 2 Discuss the following- Design Specification of Assembler Design of Single Pass Assembler


Lazytown Constabulary are concerned that young people in the town are unaware of the sorts of crime that they might encounter in their daily lives and are concerned that they may b

Question 1 Explain the three traits of Object Oriented Programming Question 2 Write a note on (a) Assignment Operators                             b) Bitwise Operators.

Web Services Information Language WCF is designed using assistance focused structure concepts to support allocated processing where solutions have distant customers. Customers can

how to get the HORIZONTAL motion field from motion vectors matrices

For this assignment you will use the robot/maze simulation example introduced in mini-assignments 0625ma-0627ma to develop a maze-solving program. The program will read a file cont

What is an algorithm? What are the characteristics of a good algorithm? An algorithm is defined as “a step-by-step procedure of accomplishing some task'''' An algorithm may be sh

Prepare an XML document that contains calendar information such as the following text describes: The calendar is owned by a person (e.g. John Smith) and has a few paragraphs tha

3d Interpolation using matlab from x,y, and z coordinates in a csv file and reading them after that interpolating them..