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
Modularity, Abstraction, and Modelling Whether proving a theorem by creating up from lemmas to simple basic theorems to more accurate results, or designing a circuit by creati

What is Data Normalization and Schema Refinement? Define briefly..

OOPS Concepts Object-oriented programming (OOP) is a computer science term used to characterize a programming language that began development in the 1960’s. The term ‘object-orient

Characteristics of object-oriented programming: •   Emphasis is on data rather than procedure. •   Programs are divided into what are known as objects. •

This assignment is divided into two parts. The goal is to write a Java program that calculates capital gain on a stock market, see Lab 7. When a share of common stock of some co

How to i write a car rental program in jgrasp

The schematic of the traffic light controller is as shown in figure 1. There are three control buttons on the panel: HAZ (Hazard), LT (Left) and RT (Right). Whenever, HAZ is clicke

Matlab Assignment # For each of the three datasets (data1.txt, data2.txt, and data3.txt in bnhw2q2.zip), cluster the data using k-means in Matlab, with k=2, 3, 4 and 5 using the pr

Develop (i) a context diagram and (ii) a use case diagram to model the following functionalities of NetFlix. Netflix is an online video/DVD renting company. A customer desiring

asample database report