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 to store multidimensional array in a single column in mysql database using MATLAB?

Problem 1. What are the potential advantages of treating two related classes as subclasses of some superclass? 2. Explain the various tools for software implementation 3.

Extend the AirRaid game, so that the planes drop a bomb on the gun as they go over it. The gun has to move out of the way otherwise it will be destroyed if hit. Provide three lives

Create the class Robot described in the Karel++ book. Description: The Robot class described in the Karel++ text is a derived class of ur_Robot. Create class Robot as a d

I have a problem which seems to be quite a rare one and I can safely say I know what exactly what is causing it. After some process of elimination I reached the conclusion that, in

Write a script called 'prob1.m' that solves for the variables y, and z in terms of a user inputed x. The variables y and z are defined as follows: y = x - 30                when

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

creating system flowchart for website

I need help with making a assembly program that uses Hoffman''s coding scheme to compress a text file.

The assignment has two parts: first you generate a simple application for a MID that operates independently of other MIDs. As a second part, the application is extended to keep so